PageSourceSearch

https://spssau.com/js/public/tool.js

js spssau.com collected 2026-09-28 07:50:36 UTC 81,726 bytes, 1,610 lines download raw bytes

1define(function (require, exports, module) {
2    /*
3     * 公共工具 Tool 
4     */
5    exports.Tool = {
6        TimeFunction: function (dateTime) {
7            if (dateTime == null || dateTime == '' || typeof (dateTime) == undefined) {
8                return {
9                    'date': 'null',
10                    'time': 'null',
11                    'dateTime': 'null'
12                }
13            }
14            var $this = this;
15            var dateTime = new Date(dateTime);
16            var year1 = dateTime.getFullYear();
17            var month1 = dateTime.getMonth() + 1;
18            var date1 = dateTime.getDate();
19            var hour1 = dateTime.getHours();
20            var minute1 = dateTime.getMinutes();
21            var second1 = dateTime.getSeconds();
22            var month2, date2, hour2, minute2, second2;
23            month2 = $this.appendZero(month1);
24            date2 = $this.appendZero(date1);
25            hour2 = $this.appendZero(hour1);
26            minute2 = $this.appendZero(minute1);
27            second2 = $this.appendZero(second1);
28            var finalDate = [year1, month2, date2].join('-');
29            var fileDate = [year1, month2, date2].join('');
30            var finalTime = [hour2, minute2, second2].join(':');
31            var fileTime = [hour2, minute2].join('-');
32            return {
33                'date': finalDate,
34                'time': finalTime,
35                'dateTime': finalDate + ' ' + finalTime,
36                'fileTime': fileDate + ' ' + fileTime,
37                'year': year1,
38                'month': [year1, month2].join('-'),
39            }
40        },
41        appendZero: function (numbers) {
42            if (numbers < 10) {
43                return "0" + numbers;
44            } else {
45                return numbers;
46            }
47        },
48        substringResult: function (stringResult) {
49            var stringResult = stringResult;
50            var indexNumber = stringResult.indexOf('_') + 1;
51            var leftResult = stringResult.substring(0, indexNumber - 1);
52            var rightResult = stringResult.substring(indexNumber);
53            return {
54                leftResult: leftResult,
55                rightResult: rightResult
56            };
57        },
58        bindScroll: function (_this) { //获取滚动事件,根据滚动条位置来决定按钮显示与否
59            _this.scroll(function () {
60                var len = $(this).scrollTop(); //获取滚动条高度
61                if (len >= 100) {
62                    //显示回到顶部按钮
63                    $('.backTop').fadeIn('1000');
64                } else {
65                    //隐藏回到顶部按钮
66                    $('.backTop').fadeOut('1000');
67                }
68            });
69        },
70        myBrowser: function () {
71            var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
72            var isOpera = userAgent.indexOf("Opera") > -1;
73            var isChrome = userAgent.indexOf("Chrome") > -1;
74            var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1 && !isOpera;
75            if (isOpera) {
76                return "Opera"
77            }; //判断是否Opera浏览器
78            if (userAgent.indexOf("Edge") > -1) {
79                return "Edge";
80            } //判断是否Edge浏览器
81            if (userAgent.indexOf("Firefox") > -1) {
82                return "FF";
83            } //判断是否Firefox浏览器
84            if (userAgent.indexOf("Chrome") > -1) {
85                return "Chrome";
86            }
87            if (userAgent.indexOf("Safari") > -1) {
88                return "Safari";
89            } //判断是否Safari浏览器
90            if (userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1 && !isOpera) {
91                return "IE";
92            }; //判断是否IE浏览器
93            if (isIE == undefined) {
94                return "IE";
95            };
96        },
97        tableScroll: function (widths) {
98            var boxWidth = widths - ($('.troublesome')[0].offsetWidth - $('.troublesome')[0].scrollWidth);
99            // $('.tableAhpBox').width(boxWidth);
100            // $('.tableAhpBox table').width(boxWidth - 1);
101            // $('.WordAnalysis').width(boxWidth);
102            // $('.GraphDraw').width(boxWidth);
103        },
104        Sizejquery: function () { //高度函数被调用
105            exports.Tool.bindScroll($('.troublesome'));
106            exports.Tool.getCopyAnalysis();
107            // console.log('高度函数被调用');
108            var rightTop = $("#right").offset().top;
109            var dealwith = $("#height").offset().top;
110            var winhei = window.innerHeight;
111            var dealheigth = winhei - dealwith - 15;
112            var leftlisttdlenght = $('#dealwith').find(".leftlisttd");
113            $("#right").height(winhei - rightTop - 15);
114            $(".dealwith").height(dealheigth);
115            if ($(".tablerow .lefts .leftsoverflowhidden").hasClass('changeHeight')) {
116                $(".tablerow .lefts .leftsoverflowhidden").height(winhei - rightTop - 70);
117            } else {
118                $(".tablerow .lefts .leftsoverflowhidden").height(winhei - rightTop - 15);
119            }
120            if ("FF" == exports.Tool.myBrowser() || "IE" == exports.Tool.myBrowser() || "Edge" == exports.Tool.myBrowser() || "Safari" == exports.Tool.myBrowser()) {
121                $("#Label_processing").children().css({
122                    "display": "table-header-group",
123                    "width": "100%",
124                    "height": "100%"
125                }).children('.Label_processing_right').css({
126                    "vertical-align": "top",
127                    "padding": "0 15px 55px"
128                });
129
130                $("#coding").children().css({
131                    "display": "table-header-group",
132                    "width": "100%",
133                    "height": "100%"
134                }).children('.Label_processing_right').css({
135                    "vertical-align": "top",
136                    "padding": "0 15px 55px"
137                });
138
139                $("#variable").children().css({
140                    "display": "table-header-group",
141                    "width": "100%",
142                    "height": "100%"
143                }).children('.Label_processing_left').css({
144                    "padding": "0 15px"
145                }).children('.helpless').css({
146                    "padding": "45px 0 0"
147                }).children('.statisticsp').css({
148                    'margin-top': '-40px',
149                    'margin-bottom': '5px'
150                });
151                $("#variable").find('.Label_processing_right').css({
152                    "vertical-align": "top",
153                    "padding": "0 15px 55px"
154                });
155                $("#exceptonValue").children().css({
156                    "display": "table-header-group",
157                    "width": "100%",
158                    "height": "100%"
159                }).children('.Label_processing_right').css({
160                    "vertical-align": "top",
161                    "padding": "0 15px 55px"
162                });
163                $("#invalid").children().css({
164                    "display": "table-header-group",
165                    "width": "100%",
166                    "height": "100%"
167                }).children('.Label_processing_right').css({
168                    "vertical-align": "top",
169                    "padding": "0 15px 55px"
170                });
171                var heightArr = [];
172                // console.log(leftlisttdlenght);
173                $.each(leftlisttdlenght, function (index, listdiv) {
174                    var listdivpheight = $(listdiv).parent().height();
175                    heightArr.push(listdivpheight);
176                    // console.log(listdivpheight);
177                    // console.log($(listdiv).height());
178                    if ("Edge" == exports.Tool.myBrowser() || "Safari" == exports.Tool.myBrowser()) {
179                        if ($(listdiv).height() > 60) {
180                            // $(listdiv).parent().css({
181                            // 	"height": "auto"
182                            // });//备注掉这个2020年03月10日;簇状图x放两项时bug 有可能影响Edge和Safari全体拖动放入表格的布局
183                        }
184                        $(listdiv).css({
185                            "height": "0"
186                        });
187
188                        $(listdiv).css({
189                            // "display": "block",
190                            "display": "table-cell",
191                            "height": "auto",
192                        });
193                    } else {
194                        if ($(listdiv).height() > 40) {
195                            // $(listdiv).parent().css({
196                            // 	"height": "auto"
197                            // });//备注掉这个2020年03月10日;簇状图x放两项时bug 有可能影响FF和Ie全体拖动放入表格的布局
198                            $(listdiv).css({
199                                "height": $(listdiv).height()
200                            });
201                        } else {
202                            $(listdiv).css({
203                                "height": listdivpheight
204                            });
205                            $(listdiv).addClass('firefoxjr');
206                        }
207                        // $(listdiv).css({
208                        // 	"height": "0"
209                        // });
210
211                    }
212
213                });
214                const HARR = heightArr;
215                setTimeout(function () {
216                    $.each(leftlisttdlenght, function (index, listdiv) {
217                        // console.log(listdiv);
218                        var listdivpheight = $(listdiv).parent().height();
219                        if (leftlisttdlenght.length < 2) {
220                            $(listdiv).css({
221                                "height": listdivpheight,
222                                "overflow-x": "hidden"
223                            }).find('ul').css("display", "block");
224                        } else {
225                            if ("Safari" == exports.Tool.myBrowser()) {
226                                //									$(listdiv).parent().css({
227                                //										"height": listdivpheight,
228                                //										"overflow-x": "hidden"
229                                //									});
230                                //									$(listdiv).css({
231                                //										//										"height": "100%"
232                                //										"height": "auto",
233                                //										"display": "table-cell"
234                                //									});
235                                if ($(listdiv).height() < 50) { } else {
236                                    $(listdiv).css({
237                                        "height": listdivpheight,
238                                        "overflow-x": "hidden"
239                                    }).find('ul').css("display", "block");
240                                }
241                            }
242                            if ("Edge" == exports.Tool.myBrowser()) {
243                                // $(listdiv).parent().css({
244                                // 	"height": listdivpheight,
245                                // 	"overflow-x": "hidden"
246                                // });
247                                // $(listdiv).css({
248                                // 	"height": "100%"
249                                // });
250                                if ($(listdiv).height() < 50) { } else {
251                                    $(listdiv).css({
252                                        "height": listdivpheight,
253                                        "overflow-x": "hidden"
254                                    }).find('ul').css("display", "block");
255                                }
256                            }
257                            if ("FF" == exports.Tool.myBrowser()) {
258                                // if ($(listdiv).height() < 70) {
259                                // 	$(listdiv).css({
260                                // 		"height": "40px",
261                                // 		"overflow-x": "hidden"
262                                // 	});
263                                // 	// $(listdiv).parent().next().find();
264                                // } else {
265                                // 	$(listdiv).css({
266                                // 		"height": listdivpheight,
267                                // 		"overflow-x": "hidden"
268                                // 	}).find('ul').css("display", "block");
269                                // }
270                                $(listdiv).css({
271                                    "height": HARR[index],
272                                    "overflow-x": "hidden"
273                                });
274
275                            }
276                            // if ($(listdiv).height() < 50) {
277                            // 	//$(listdiv).css({"height":"40px","overflow-x":"hidden"}).find('ul').css("display","block");
278                            // } else {
279                            // 	// console.log($(listdiv).height());
280                            // 	// console.log(listdivpheight);
281                            // 	$(listdiv).css({
282                            // 		"height": listdivpheight,
283                            // 		"overflow-x": "hidden"
284                            // 	}).find('ul').css("display", "block");
285                            // }
286                        }
287                    });
288                }, 250);
289            }
290            setTimeout(function () {
291                var dealwiths = $("#height").offset().top;
292                var winheis = $(window).height();
293                var dealheigths = winheis - dealwiths - 15;
294                $(".dealwith").height(dealheigths);
295                // $(".dealwith").find('.Label_processing_right').find('.helpless').height(dealheigths - 125);
296                $(".dealwith").find('.Label_processing_left').find('.helpless ul').height(dealheigths - 60);
297                $(".dealwith").find('.Label_processing_right').find('.helpless ul').height(dealheigths - 120);
298                $(".dealwith").find('.Label_processing_right').find('.helplesss').height(dealheigths - 135);
299                // $("#title_treatment").css("height", dealheigths);
300            }, 200); //360這個坑貨 延遲 執行js 
301            setTimeout(function () {
302                if ("FF" == exports.Tool.myBrowser() && leftlisttdlenght.length > 1 && leftlisttdlenght.length < 15) {
303                    $(".firefoxjr").css({
304                        "height": '40px'
305                    });
306                    $('.firefoxjr').parent().css({
307                        "height": '40px',
308                    });
309                }
310                // $("#title_treatment").css("height", (dealheigth - 10));
311                // $("#title_treatment").css("height", dealheigth);
312            }, 300);
313            $("#loadshow").hide();
314        },
315        ResultsBinding: function (right) {
316            // roc最后一个表格
317            $(right).on("focus blur propertychange", ".rocTableInput1,.rocTableInput2,.rocTableInput3,.rocTableInput4", function (event) {
318                event.stopPropagation();
319                if (event.type == "focusin") {
320                    $(this).removeClass("rocTableInputRed");
321                    $(this).addClass("rocTableInputBlue");
322                } else if (event.type == "focusout") {
323                    if ($(this).val() != null && $(this).val() != '') {
324                        $(this).removeClass("rocTableInputRed");
325                        $(this).removeClass("rocTableInputBlue");
326                        if ($('.rocTableInput1').val() != '' && $('.rocTableInput3').val() != '') {
327                            var rocTableResult = $('.rocTableInput1').val() - $('.rocTableInput3').val();
328                            $('#rocTableDifference').text(rocTableResult.toFixed(4));
329                            if ($('.rocTableInput2').val() != '' && $('.rocTableInput4').val() != '') {
330                                var rocTableResultZ = ($('.rocTableInput1').val() - $('.rocTableInput3').val()) / Math.pow((Math.pow($('.rocTableInput2').val(), 2) + Math.pow($('.rocTableInput4').val(), 2)), 0.5);
331                                $('#rocTableZ').text(rocTableResultZ.toFixed(4));
332                                var rocTableResultP = (1 - exports.Tool.normal(Math.abs(rocTableResultZ), 0, 1)) * 2;
333                                $('#rocTableP').text(rocTableResultP.toFixed(4));
334                            } else {
335                                $('#rocTableZ').text("");
336                                $('#rocTableP').text("");
337                            }
338                        } else {
339                            $('#rocTableDifference').text("");
340                            $('#rocTableZ').text("");
341                            $('#rocTableP').text("");
342                        }
343                    } else if ($(this).val() == '') {
344                        $(this).removeClass("rocTableInputBlue");
345                        $(this).addClass("rocTableInputRed");
346                        if ($('.rocTableInput1').val() != '' && $('.rocTableInput3').val() != '') {
347                            var rocTableResult = $('.rocTableInput1').val() - $('.rocTableInput3').val();
348                            $('#rocTableDifference').text(rocTableResult.toFixed(4));
349                            if ($('.rocTableInput2').val() == '' || $('.rocTableInput4').val() == '') {
350                                var rocTableResultZ = ($('.rocTableInput1').val() - $('.rocTableInput3').val()) / Math.pow((Math.pow($('.rocTableInput2').val(), 2) + Math.pow($('.rocTableInput4').val(), 2)), 0.5);
351                                $('#rocTableZ').text("");
352                                $('#rocTableP').text("");
353                            }
354                        } else if ($('.rocTableInput1').val() == '' || $('.rocTableInput3').val() == '') {
355                            $('#rocTableDifference').text("");
356                            $('#rocTableZ').text("");
357                            $('#rocTableP').text("");
358                        }
359                    }
360                }
361            });
362            // fuzzy5最后一个表格
363            $(right).on("focus blur propertychange", ".scoreTdInput", function (event) {
364                event.stopPropagation();
365                if (event.type == "focusin") {
366                    $(this).removeClass("rocTableInputRed");
367                    $(this).addClass("rocTableInputBlue");
368                } else if (event.type == "focusout") {
369                    var scoreTdSum = 0;
370                    if ($(this).val() != null && $(this).val() != '') {
371                        $(this).removeClass("rocTableInputRed");
372                        $(this).removeClass("rocTableInputBlue");
373                        for (var i = 0; i < $(this).parents("tr").find("input").length; i++) {
374                            scoreTdSum += $($(this).parents("tr").find("input")[i]).val() * $("#resultVectorId" + i).attr('data-value');
375                        }
376                        $("#compositeScore").html(scoreTdSum.toFixed(3));
377                    } else if ($(this).val() == '') {
378                        $(this).removeClass("rocTableInputBlue");
379                        $(this).addClass("rocTableInputRed");
380                    }
381                }
382            });
383            $(right).on("change", ".subtotalChange,.subtotalcolChange,.entropyChange,.entropyChange1,.npsoneChange,.npstwoChange,.rfmChange,.rfmTypeChange,.varSelect,.varVdSelect, .fisherChiSelect, .singleMulRegChange", function (event) {
384                event.stopPropagation();
385                var this_val = $(this);
386                if (this_val[0].className == 'subtotalChange') {
387                    if (this_val.val() == 2) {
388                        this_val.parents("#t1").html($("#t2").html());
389                    } else if (this_val.val() == 3) {
390                        this_val.parents("#t1").html($("#t3").html());
391                    } else if (this_val.val() == 4) {
392                        this_val.parents("#t1").html($("#t4").html());
393                    } else if (this_val.val() == 5) {
394                        this_val.parents("#t1").html($("#t5").html());
395                    } else if (this_val.val() == 6) {
396                        this_val.parents("#t1").html($("#t6").html());
397                    } else if (this_val.val() == 7) {
398                        this_val.parents("#t1").html($("#t7").html());
399                    } else if (this_val.val() == 8) {
400                        this_val.parents("#t1").html($("#t8").html());
401                    } else if (this_val.val() == 9) {
402                        this_val.parents("#t1").html($("#t9").html());
403                    } else if (this_val.val() == 10) {
404                        this_val.parents("#t1").html($("#t10").html());
405                    }
406                } else if (this_val[0].className == 'subtotalcolChange') {
407                    if (this_val.val() == 2) {
408                        this_val.parents("#t1").html($("#t2").html());
409                    } else if (this_val.val() == 3) {
410                        this_val.parents("#t1").html($("#t3").html());
411                    } else if (this_val.val() == 4) {
412                        this_val.parents("#t1").html($("#t4").html());
413                    } else if (this_val.val() == 5) {
414                        this_val.parents("#t1").html($("#t5").html());
415                    }
416                } else if (this_val[0].className == 'entropyChange') {
417                    if (this_val.val() == 2) {
418                        this_val.parents("#t1").html($("#t2").html());
419                    } else if (this_val.val() == 3) {
420                        this_val.parents("#t1").html($("#t3").html());
421                    } else if (this_val.val() == 4) {
422                        this_val.parents("#t1").html($("#t4").html());
423                    }
424                } else if (this_val[0].className == 'entropyChange1') {
425                    var index = this_val.parents("table")[0].id.replace(/t/ig, '');
426                    if (this_val.val() == 2) {
427                        this_val.parents("#t" + index).html($("#tt" + index).html());
428                    } else if (this_val.val() == 3) {
429                        this_val.parents("#t" + index).html($("#ttt" + index).html());
430                    } else if (this_val.val() == 4) {
431                        this_val.parents("#t" + index).html($("#tttt" + index).html());
432                    }
433                } else if (this_val[0].className == 'npsoneChange') {
434                    if (this_val.val() == 2) {
435                        this_val.parents("#t1").html($("#t2").html());
436                    } else if (this_val.val() == 3) {
437                        this_val.parents("#t1").html($("#t3").html());
438                    }
439                } else if (this_val[0].className == 'npstwoChange') {
440                    if (this_val.val() == 2) {
441                        this_val.parents("#t4").html($("#t5").html());
442                    } else if (this_val.val() == 3) {
443                        this_val.parents("#t4").html($("#t6").html());
444                    }
445                } else if (this_val[0].className == 'rfmChange') {
446                    if (this_val.val() == 2) {
447                        this_val.parents("#t1").html($("#t2").html());
448                    } else if (this_val.val() == 3) {
449                        this_val.parents("#t1").html($("#t3").html());
450                    }
451                } else if (this_val[0].className == 'rfmTypeChange') {
452                    if (this_val.val() == 2) {
453                        this_val.parents("#t5").html($("#t6").html());
454                    } else if (this_val.val() == 3) {
455                        this_val.parents("#t5").html($("#t7").html());
456                    }
457                } else if (this_val[0].className == 'varSelect' || this_val[0].className == 'varVdSelect') {
458                    $(`.${this_val.parents('.tableAhpBox').attr('class').split(' ')[1]}`).hide();
459                    $(`.${this_val.val()}`).show();
460                    this_val.val(this_val.parents('.tableAhpBox').attr('class').split(' ')[1]);
461                } else if (this_val[0].className == 'fisherChiSelect') {
462                    $(this_val.parents(".tableAhpBox").children("table")).hide();
463                    $(`#${this_val.val()}`).show();
464                    this_val.val(this_val.parents('table').attr('id'));
465                } else if (this_val[0].className == 'singleMulRegChange') {
466                    this_val.parents("#t2").html($("#t" + this_val.val() + "").html());
467                }
468            });
469            $(right).on('input propertychange', '.dependentvariablevalue1,.dependentvariablevalue2,.dependentvariablevalue3,.dependentvariablevalue4,.dependentvariablevalue5,.dependentvariablevalue6,.dependentvariablevalue7,.dependentvariablevalue8,.content .tablerow .right .dealwith .WordAnalysis .dependentvariable1', function (event) {
470                event.stopPropagation();
471                if ($(this)[0].className == 'dependentvariablevalue1') {
472                    var indexsun = 0;
473                    var variables = Public.senStrg("variables");
474                    var variablesarray = variables.split(",");
475                    //indexsun += parseFloat(parseFloat(variablesarray[0]));
476                    for (var i = 0; i < variablesarray.length; i++) {
477                        if (i == 0) {
478                            indexsun += parseFloat(variablesarray[0]);
479                        } else {
480                            indexsun += (parseFloat(variablesarray[i]) * $('#inputindex' + (i - 1)).val());
481                        }
482                    }
483                    $('.dependentvariablevalue').html(indexsun.toFixed(10));
484                } else if ($(this)[0].className == 'dependentvariablevalue2') {
485                    var indexsun = parseFloat(Public.senStrg("indexsun"));
486                    var variables = Public.senStrg("variables");
487                    var variablesarray = variables.split(",");
488                    for (var i = 0; i < variablesarray.length; i++) {
489                        indexsun += (parseFloat(variablesarray[i]) * $('#inputindex' + i).val());
490                    }
491                    $('.dependentvariablevalue').html(indexsun.toFixed(10));
492                } else if ($(this)[0].className == 'dependentvariablevalue3') {
493                    var indexsun = 0;
494                    var variables = Public.senStrg("variables");
495                    var variablesarray = variables.split(",");
496                    //							indexsun += parseFloat(parseFloat(variablesarray[variablesarray.length - 1]));
497                    for (var i = 0; i < variablesarray.length; i++) {
498                        if (i == variablesarray.length - 1) {
499                            indexsun += parseFloat(variablesarray[variablesarray.length - 1]);
500                        } else {
501                            indexsun += (parseFloat(variablesarray[i]) * $('#inputindex' + i).val());
502                        }
503                    }
504                    $('.dependentvariablevalue').html(indexsun.toFixed(10));
505                } else if ($(this)[0].className == 'dependentvariablevalue4') {
506                    var indexsun = parseFloat(Public.senStrg("indexsun"));
507                    var variables = Public.senStrg("variables");
508                    var variablesarray = variables.split(",");
509                    for (var i = 0; i < variablesarray.length; i++) {
510                        indexsun += (parseFloat(variablesarray[i]) * $('#inputindex' + i).val());
511                    }
512                    $('.dependentvariablevalue').html(indexsun.toFixed(10));
513                } else if ($(this)[0].className == 'dependentvariablevalue5') {
514                    var indexsun = parseFloat(Public.senStrg("indexsun"));
515                    var variables = Public.senStrg("variables");
516                    var variablesarray = variables.split(",");
517                    var itemchecked = Public.senStrg("itemchecked");
518                    // let finalinputVal = 1;
519                    var finalinputVal = 1;
520                    for (var i = 0; i < variablesarray.length - 1; i++) {
521                        if (itemchecked == "Poisson" || itemchecked == "negBiRegression") {
522                            if (Public.senStrg("cardinal")) {
523                                if (i == variablesarray.length - 2) {
524                                    indexsun += (parseFloat(variablesarray[i]) * $('#inputindex' + i).val()) + Math.log($('#inputindex' + (i + 1)).val());
525                                } else {
526                                    indexsun += (parseFloat(variablesarray[i]) * $('#inputindex' + i).val());
527                                }
528                                if ($('#inputindex' + i).val() != '' && $('#inputindex' + (variablesarray.length - 2)).val() != '') {
529                                    finalinputVal = 2;
530                                }
531                            } else {
532                                indexsun += (parseFloat(variablesarray[i]) * $('#inputindex' + i).val());
533                                if ($('#inputindex' + i).val() != '') {
534                                    finalinputVal = 2;
535                                }
536                            }
537                        } else {
538                            indexsun += (parseFloat(variablesarray[i]) * $('#inputindex' + i).val());
539                            if ($('#inputindex' + i).val() != '') {
540                                finalinputVal = 2;
541                            }
542                        }
543                    }
544
545                    if (itemchecked == "Logit") {
546                        if (finalinputVal == 1) {
547                            indexsun = "";
548                        } else if (finalinputVal == 2) {
549                            indexsun = Math.exp(indexsun) / (1 + Math.exp(indexsun));
550                        }
551                    } else if (itemchecked == "Poisson") {
552                        if (finalinputVal == 1) {
553                            indexsun = "";
554                        } else if (finalinputVal == 2) {
555                            indexsun = Math.exp(indexsun);
556                        }
557                    } else if (itemchecked == "negBiRegression") {
558                        if (finalinputVal == 1) {
559                            indexsun = "";
560                        } else if (finalinputVal == 2) {
561                            indexsun = Math.exp(indexsun);
562                        }
563                    } else if (itemchecked == "Probit") {
564                        if (finalinputVal == 1) {
565                            indexsun = "";
566                        } else if (finalinputVal == 2) {
567                            indexsun = exports.Tool.normalcdf(0, 1, indexsun);
568                        }
569                    }
570                    if (indexsun == "") {
571                        $('.dependentvariablevalue').html(indexsun);
572                    } else {
573                        $('.dependentvariablevalue').html(indexsun.toFixed(10));
574                    }
575                } else if ($(this)[0].className == 'dependentvariablevalue6') {
576                    var variables = Public.senStrg("variables");
577                    var urlsQuadratic = Public.senStrg("urlsQuadratic");
578                    var variablesarray = variables.split(",");
579                    if (urlsQuadratic == 0) {
580                        var indexsun = 0;
581                        indexsun += parseFloat(variablesarray[0]) + (parseFloat(variablesarray[1]) * $('#inputindex0').val()) + (parseFloat(variablesarray[2]) * Math.pow($('#inputindex0').val(), 2));
582                    } else if (urlsQuadratic == 1) {
583                        var indexsun = 0;
584                        indexsun += parseFloat(variablesarray[0]) + (parseFloat(variablesarray[1]) * $('#inputindex0').val()) + (parseFloat(variablesarray[2]) * Math.pow($('#inputindex0').val(), 2) + (parseFloat(variablesarray[3]) * Math.pow($('#inputindex0').val(), 3)));
585                    } else if (urlsQuadratic == 2) {
586                        var indexsun = 0;
587                        indexsun += parseFloat(variablesarray[0]) + (parseFloat(variablesarray[1]) * Math.log($('#inputindex0').val()));
588                    } else if (urlsQuadratic == 3) {
589                        var indexsun = 0;
590                        indexsun += Math.exp(parseFloat(variablesarray[0]) + (parseFloat(variablesarray[1]) * $('#inputindex0').val()));
591                    } else if (urlsQuadratic == 4) {
592                        var indexsun = 0;
593                        indexsun += Math.exp(parseFloat(variablesarray[0]) + (parseFloat(variablesarray[1]) * $('#inputindex0').val()));
594                    } else if (urlsQuadratic == 5) {
595                        var indexsun = 0;
596                        indexsun += Math.exp(parseFloat(variablesarray[0]) + (parseFloat(variablesarray[1]) * $('#inputindex0').val()));
597                    } else if (urlsQuadratic == 6) {
598                        var indexsun = 0;
599                        indexsun += Math.exp(parseFloat(variablesarray[0]) + parseFloat(variablesarray[1]) * (1 / $('#inputindex0').val()));
600                    }
601                    $('.dependentvariablevalue').html(indexsun.toFixed(10));
602                } else if ($(this)[0].className == 'dependentvariablevalue7') {
603                    var nonlinearcoefs = Public.senStrg("nonlinearcoefs");
604                    var nonlinearselect = Public.senStrg("nonlinearselect");
605                    var nonlinearcoefsArray = nonlinearcoefs.split(",");
606                    var x;
607                    var arr = [];
608                    for (var i = 0; i < $('.dependentvariablevalue7').parents('ul').find('.dependentvariablevalue7').length; i++) {
609                        arr.push($($('.dependentvariablevalue7')[i]).val());
610                    }
611                    if (arr.length > 1) {
612                        x = arr;
613                    } else {
614                        [x] = [...arr]
615                    }
616                    var yPredicts = exports.Tool.getYPredicts(Number(nonlinearselect), nonlinearcoefsArray, x).yPredicts;
617                    $('.dependentvariablevalue').html(yPredicts.toFixed(10));
618                }
619            });
620
621            $(right).on('click', '.ascending_img,.ascending_img1', function (event) {
622                event.stopPropagation();
623                var as = $(this), limit = $(this).next('.hide_load_factor').val();
624                if (as.hasClass('ascending_img')) {
625                    if (as.parents("#t3").html() == $("#t5").html()) {
626                        as.parents("#t3").html($("#t6").html());
627                    } else {
628                        as.parents("#t3").html($("#t5").html());
629                    }
630                } else if (as.hasClass('ascending_img1')) {
631                    var markTable = Public.senStrg('marktable');
632                    if (!markTable) {
633                        markTable = 0;
634                    }
635                    if (markTable == 0) {
636                        as.parents("#t3").html($("#t5").html());
637                        markTable = 1;
638                    } else if (markTable == 1) {
639                        as.parents("#t3").html($("#t6").html());
640                        markTable = 2;
641                    } else if (markTable == 2) {
642                        as.parents("#t3").html($("#t7").html());
643                        markTable = 0;
644                    }
645                    Public.senStrg('marktable', markTable);
646                }
647                $('#t3 .hide_load_factor').val(limit);
648            });
649
650            $(right).on('change', '.hide_load_factor', function (event) {
651                event.stopPropagation();
652                var limit = $(this).val(), num = $(this).attr('data-num');
653                if (limit > 0) {
654                    $("#t3 tbody tr:lt(" + num + ")").find("td:not(:first-child):not(:last-child)").each(function () {
655                        if (Math.abs(parseFloat($(this).text())) < limit) {
656                            $(this).css('opacity', 0);
657                        } else {
658                            $(this).removeAttr('style');
659                        }
660                    });
661                    $("#t5 tbody tr:lt(" + num + ")").find("td:not(:first-child):not(:last-child)").each(function () {
662                        if (Math.abs(parseFloat($(this).text())) < limit) {
663                            $(this).css('opacity', 0);
664                        } else {
665                            $(this).removeAttr('style');
666                        }
667                    });
668                    $("#t6 tbody tr:lt(" + num + ")").find("td:not(:first-child):not(:last-child)").each(function () {
669                        if (Math.abs(parseFloat($(this).text())) < limit) {
670                            $(this).css('opacity', 0);
671                        } else {
672                            $(this).removeAttr('style');
673                        }
674                    });
675                } else {
676                    $('#t3 tr td').css('opacity', '');
677                    $('#t5 tr td').css('opacity', '');
678                    $('#t6 tr td').css('opacity', '');
679                }
680            });
681        },
682        normalcdf: function (mean, sigma, to) {
683            var z = (to - mean) / Math.sqrt(2 * sigma * sigma);
684            var t = 1 / (1 + 0.3275911 * Math.abs(z));
685            var a1 = 0.254829592;
686            var a2 = -0.284496736;
687            var a3 = 1.421413741;
688            var a4 = -1.453152027;
689            var a5 = 1.061405429;
690            var erf = 1 - (((((a5 * t + a4) * t) + a3) * t + a2) * t + a1) * t * Math.exp(-z * z);
691            var sign = 1;
692            if (z < 0) {
693                sign = -1;
694            }
695            return (1 / 2) * (1 + sign * erf);
696        },
697        normal: function (x, mu, sigma) {
698            return exports.Tool.stdNormal((x - mu) / sigma);
699        },
700
701        stdNormal: function (z) {
702            var j, k, kMax, m, values, total, subtotal, item, z2, z4, a, b;
703
704            // Power series is not stable at these extreme tail scenarios
705            if (z < -6) {
706                return 0;
707            }
708            if (z > 6) {
709                return 1;
710            }
711
712            m = 1; // m(k) == (2**k)/factorial(k)
713            b = z; // b(k) == z ** (2*k + 1)
714            z2 = z * z; // cache of z squared
715            z4 = z2 * z2; // cache of z to the 4th
716            values = [];
717
718            // Compute the power series in groups of two terms.
719            // This reduces floating point errors because the series
720            // alternates between positive and negative.
721            for (k = 0; k < 100; k += 2) {
722                a = 2 * k + 1;
723                item = b / (a * m);
724                item *= (1 - (a * z2) / ((a + 1) * (a + 2)));
725                values.push(item);
726                m *= (4 * (k + 1) * (k + 2));
727                b *= z4;
728            }
729
730            // Add the smallest terms to the total first that
731            // way we minimize the floating point errors.
732            total = 0;
733            for (k = 49; k >= 0; k--) {
734                total += values[k];
735            }
736
737            // Multiply total by 1/sqrt(2*PI)
738            // Then add 0.5 so that stdNormal(0) === 0.5
739            return 0.5 + 0.3989422804014327 * total;
740        },
741        getYPredicts: function (methodId, coefs, x) {
742            var yPredicts, leftTitle;
743            var [coefs1, coefs2, coefs3, coefs4, coefs5] = [...coefs];
744            if ($.isArray(x) == true && x.length > 1) {
745                var [x1, x2, x3] = [...x];
746            }
747            coefs1 = Number(coefs1);
748            coefs2 = Number(coefs2);
749            coefs3 = Number(coefs3);
750            coefs4 = Number(coefs4);
751            coefs5 = Number(coefs5);
752            x1 = Number(x1);
753            x2 = Number(x2);
754            x3 = Number(x3);
755            switch (methodId) {
756                // switch (data.data.methodId) {
757                case 1:
758                    yPredicts = coefs1 * Math.pow(coefs2, x);
759                    leftTitle = "复合曲线";
760                    break;
761                case 2:
762                    yPredicts = coefs1 + coefs2 * x + coefs3 * Math.pow(x, 2) + coefs4 * Math.pow(x, 3);
763                    leftTitle = "三次曲线";
764                    break;
765                case 3:
766                    yPredicts = Math.exp(coefs1 + coefs2 * x);
767                    leftTitle = "增长曲线";
768                    break;
769                case 4:
770                    yPredicts = coefs1 + coefs2 / x;
771                    leftTitle = "双曲线";
772                    break;
773                case 5:
774                    yPredicts = coefs1 + coefs2 * Math.log(x);
775                    leftTitle = "对数曲线";
776                    break;
777                case 6:
778                    yPredicts = coefs1 * Math.pow(x, coefs2);
779                    leftTitle = "幂函数";
780                    break;
781                case 7:
782                    yPredicts = coefs1 * Math.exp(coefs2 * x);
783                    leftTitle = "指数函数";
784                    break;
785                case 8:
786                    yPredicts = coefs1 + coefs2 * x + coefs3 * Math.pow(x, 2);
787                    leftTitle = "二次曲线";
788                    break;
789                case 9:
790                    yPredicts = Math.exp(coefs1 + coefs2 / x);
791                    leftTitle = "S曲线";
792                    break;
793                case 10:
794                    yPredicts = 1 / (coefs1 + coefs2 * Math.exp(-x));
795                    leftTitle = "S曲线";
796                    break;
797                case 11:
798                    yPredicts = 1 - Math.exp(-coefs1 * Math.pow(x, coefs2));
799                    leftTitle = "双参数S形曲线";
800                    break;
801                case 12:
802                    yPredicts = 1 - Math.exp(-Math.exp(coefs1 - coefs2 * x));
803                    leftTitle = "双参数S形曲线";
804                    break;
805                case 13:
806                    yPredicts = coefs1 - coefs2 * Math.exp(-coefs3 * x);
807                    leftTitle = "渐进回归(凹入)";
808                    break;
809                case 14:
810                    yPredicts = coefs1 - coefs2 * Math.exp(-coefs3 * x);
811                    leftTitle = "渐进回归(凸起)";
812                    break;
813                case 15:
814                    yPredicts = coefs1 + coefs2 * Math.exp(coefs3 * x);
815                    leftTitle = "渐近";
816                    break;
817                case 16:
818                    yPredicts = coefs1 - coefs2 * Math.pow(coefs3, x);
819                    leftTitle = "渐近";
820                    break;
821                case 17:
822                    yPredicts = coefs1 + (coefs2 - coefs1) * Math.exp(-coefs3 * Math.pow(x - coefs4, 2));
823                    leftTitle = "Bragg方程";
824                    break;
825                case 18:
826                    yPredicts = coefs1 * Math.log(x - coefs2);
827                    leftTitle = "凹入";
828                    break;
829                case 19:
830                    yPredicts = 1 - 1 / Math.pow(x, coefs1);
831                    leftTitle = "凹入";
832                    break;
833                case 20:
834                    yPredicts = 1 / (1 + coefs1 * x);
835                    leftTitle = "凸起";
836                    break;
837                case 21:
838                    yPredicts = Math.pow(coefs1, x);
839                    leftTitle = "凸起";
840                    break;
841                case 22:
842                    yPredicts = 1 - 1 / Math.pow(x, coefs1);
843                    leftTitle = "凸起";
844                    break;
845                case 23:
846                    yPredicts = coefs1 / (x - coefs2);
847                    leftTitle = "有效积温";
848                    break;
849                case 24:
850                    yPredicts = Math.pow(coefs1 + coefs2 * x, -1 / coefs3);
851                    leftTitle = "密度";
852                    break;
853                case 25:
854                    yPredicts = x1 * x2 / (coefs1 + coefs2 * x1 + coefs3 * x1 * x2 + coefs4 * x1 * x3);
855                    leftTitle = "酶反应";
856                    break;
857                case 26:
858                    yPredicts = coefs1 + coefs2 * Math.pow(coefs3, x);
859                    leftTitle = "修正指数函数";
860                    break;
861                case 27:
862                    yPredicts = coefs1 * Math.cos(x + coefs2) + coefs3 * Math.cos(2 * x + coefs2) + coefs4;
863                    leftTitle = "Fourier";
864                    break;
865                case 28:
866                    yPredicts = coefs1 * Math.cos(x + coefs4) + coefs2 * Math.cos(2 * x + coefs4) + coefs3 * Math.cos(3 * x + coefs4);
867                    leftTitle = "Fourier";
868                    break;
869                case 29:
870                    yPredicts = coefs1 * (1 - coefs2 * Math.exp(-coefs3 * Math.pow(x, 2)));
871                    leftTitle = "高斯";
872                    break;
873                case 30:
874                    yPredicts = coefs1 * Math.exp(-coefs2 * Math.exp(-coefs3 * x));
875                    leftTitle = "Gompertz";
876                    break;
877                case 31:
878                    yPredicts = 1 / (coefs1 + coefs2 * Math.pow(x - coefs3, 2));
879                    leftTitle = "Holiday";
880                    break;
881                case 32:
882                    yPredicts = coefs1 * Math.exp(-coefs2 / (x + coefs3));
883                    leftTitle = "Johnson-Schumacher";
884                    break;
885                case 33:
886                    yPredicts = coefs1 / (1 + Math.exp(coefs2 + coefs3 * x));
887                    leftTitle = "逻辑斯蒂";
888                    break;
889                case 34:
890                    yPredicts = coefs1 + (coefs2 - coefs1) / (1 + Math.exp((x - coefs3) / coefs4));
891                    leftTitle = "Logistic增长";
892                    break;
893                case 35:
894                    yPredicts = coefs1 - Math.log(1 + coefs2 * Math.exp(-coefs3 * x));
895                    leftTitle = "对数Logit";
896                    break;
897                case 36:
898                    yPredicts = coefs1 + (coefs2 - coefs1) / (1 + Math.exp(coefs4 * Math.log(x / coefs3)));
899                    leftTitle = "Loglogistic增长";
900                    break;
901                case 37:
902                    yPredicts = Math.pow(coefs1 + coefs2 * x, coefs3);
903                    leftTitle = "对数修改";
904                    break;
905                case 38:
906                    yPredicts = coefs1 + coefs2 * Math.exp(-coefs3 * x);
907                    leftTitle = "Metcherlich Law of Diminishing Returns";
908                    break;
909                case 39:
910                    yPredicts = coefs1 * x / (x + coefs2);
911                    leftTitle = "Michaelis Menten";
912                    break;
913                case 40:
914                    yPredicts = (coefs1 * coefs2 + coefs3 * Math.pow(x, coefs4)) / (coefs2 + Math.pow(x, coefs4));
915                    leftTitle = "Morgan-Mercer-Florin";
916                    break;
917                case 41:
918                    yPredicts = coefs1 * Math.exp(coefs2 / x);
919                    leftTitle = "负指数函数";
920                    break;
921                case 42:
922                    yPredicts = coefs1 - coefs2 * (Math.log(x1 + coefs3) - Math.log(x2));
923                    leftTitle = "Nernst方程";
924                    break;
925                case 43:
926                    yPredicts = coefs1 / (1 + coefs2 * Math.exp(-(coefs3 * x + coefs4 * Math.pow(x, 2) + coefs5 * Math.pow(x, 3))));
927                    leftTitle = "Peal-Reed";
928                    break;
929                case 44:
930                    yPredicts = (coefs1 + coefs2 * x + coefs3 * Math.pow(x, 2) + coefs4 * Math.pow(x, 3)) / (coefs5 * Math.pow(x, 3));
931                    leftTitle = "三次比";
932                    break;
933                case 45:
934                    yPredicts = (coefs1 + coefs2 * x + coefs3 * Math.pow(x, 2)) / (coefs4 * Math.pow(x, 2));
935                    leftTitle = "四次比";
936                    break;
937                case 46:
938                    yPredicts = (coefs1 + coefs2 * x) / (1 + coefs3 * x + coefs4 * Math.pow(x, 2));
939                    leftTitle = "有理多项式函数";
940                    break;
941                case 47:
942                    yPredicts = (coefs1 + coefs2 * x + coefs3 * Math.pow(x, 2)) / (1 + coefs4 * x + coefs5 * Math.pow(x, 2));
943                    leftTitle = "有理多项式函数";
944                    break;
945                case 48:
946                    yPredicts = coefs1 / Math.pow((1 + coefs2 * Math.exp(-coefs3 * x)), 1 / coefs4);
947                    leftTitle = "Richards";
948                    break;
949                case 49:
950                    yPredicts = coefs1 / (1 + coefs2 * Math.exp(-coefs3 * x));
951                    leftTitle = "Verhulst";
952                    break;
953                case 50:
954                    yPredicts = Math.pow(Math.pow(coefs1, 1 - coefs2) - coefs3 * Math.exp(-coefs4 * x), 1 / (1 - coefs2));
955                    leftTitle = "Von Bertalanffy";
956                    break;
957                case 51:
958                    yPredicts = coefs1 - (coefs2 - coefs1) * Math.exp(-coefs3 * Math.pow(x, coefs4));
959                    leftTitle = "Weibull";
960                    break;
961                case 52:
962                    yPredicts = Math.pow(coefs1 + coefs2 * x + coefs3 * Math.pow(x, 2), -1);
963                    leftTitle = "产量密度";
964                    break;
965                default:
966            }
967            return {
968                "yPredicts": yPredicts,
969                "leftTitle": leftTitle
970            }
971        },
972        functionFormulaType: function (val) {
973            val = Number(val);
974            var Formula;
975            var FormulaShow;
976            switch (val) {
977                case 1:
978                    FormulaShow = "b1 * b2 ** x";
979                    Formula = "b1 * b2 ** x1";
980                    break;
981                case 2:
982                    FormulaShow = "b1 + b2 * x + b3 * x ** 2 + b4 * x ** 3";
983                    Formula = "b1 + b2 * x1 + b3 * x1 ** 2 + b4 * x1 ** 3";
984                    break;
985                case 3:
986                    FormulaShow = "exp(b1 + b2 * x)";
987                    Formula = "exp(b1 + b2 * x1)";
988                    break;
989                case 4:
990                    FormulaShow = "b1 + b2 / x";
991                    Formula = "b1 + b2 / x1";
992                    break;
993                case 5:
994                    FormulaShow = "b1 + b2 * ln(x)";
995                    Formula = "b1 + b2 * ln(x1)";
996                    break;
997                case 6:
998                    FormulaShow = "b1 * x ** b2";
999                    Formula = "b1 * x1 ** b2";
1000                    break;
1001                case 7:
1002                    FormulaShow = "b1 * exp(b2 * x)";
1003                    Formula = "b1 * exp(b2 * x1)";
1004                    break;
1005                case 8:
1006                    FormulaShow = "b1 + b2 * x + b3 * x ** 2";
1007                    Formula = "b1 + b2 * x1 + b3 * x1 ** 2";
1008                    break;
1009                case 9:
1010                    FormulaShow = "exp(b1 + b2 / x1)";
1011                    Formula = "exp(b1 + b2 / x1)";
1012                    break;
1013                case 10:
1014                    FormulaShow = "1 / (b1 + b2 * exp(-x))";
1015                    Formula = "1 / (b1 + b2 * exp(-x1))";
1016                    break;
1017                case 11:
1018                    FormulaShow = "1 - exp(-b1 * x ** b2)";
1019                    Formula = "1 - exp(-b1 * x1 ** b2)";
1020                    break;
1021                case 12:
1022                    FormulaShow = "1 – exp(-exp(b1 – b2 * x))";
1023                    Formula = "1 – exp(-exp(b1 – b2 * x1))";
1024                    break;
1025                case 13:
1026                    FormulaShow = "b1 – b2 * exp(-b3 * x)";
1027                    Formula = "b1 – b2 * exp(-b3 * x1)";
1028                    break;
1029                case 14:
1030                    FormulaShow = "b1 – b2 * exp(-b3 * x)";
1031                    Formula = "b1 – b2 * exp(-b3 * x1)";
1032                    break;
1033                case 15:
1034                    FormulaShow = "b1 + b2 * exp(b3 * x)";
1035                    Formula = "b1 + b2 * exp(b3 * x1)";
1036                    break;
1037                case 16:
1038                    FormulaShow = "b1 - b2 * b3 ** x";
1039                    Formula = "b1 - b2 * b3 ** x1";
1040                    break;
1041                case 17:
1042                    FormulaShow = "b1 + (b2 – b1) * exp(-b3 * (x – b4) ** 2)";
1043                    Formula = "b1 + (b2 – b1) * exp(-b3 * (x1 – b4) ** 2)";
1044                    break;
1045                case 18:
1046                    FormulaShow = "b1 * ln(x – b2)";
1047                    Formula = "b1 * ln(x1 – b2)";
1048                    break;
1049                case 19:
1050                    FormulaShow = "1 – 1 / x ** b1";
1051                    Formula = "1 – 1 / x1 ** b1";
1052                    break;
1053                case 20:
1054                    FormulaShow = "1 / (1 + b1 * x)";
1055                    Formula = "1 / (1 + b1 * x1)";
1056                    break;
1057                case 21:
1058                    FormulaShow = "b1 ** x";
1059                    Formula = "b1 ** x1";
1060                    break;
1061                case 22:
1062                    FormulaShow = "1 – 1 / x ** b1";
1063                    Formula = "1 – 1 / x1 ** b1";
1064                    break;
1065                case 23:
1066                    FormulaShow = "b1 / (x - b2)";
1067                    Formula = "b1 / (x1 - b2)";
1068                    break;
1069                case 24:
1070                    FormulaShow = "(b1 + b2 * x) ** (-1 / b3)";
1071                    Formula = "(b1 + b2 * x1) ** (-1 / b3)";
1072                    break;
1073                case 25:
1074                    FormulaShow = "x1 * x2 / (b1 + b2 * x1 + b3 * x1 * x2 + b4 * x1 *x3)";
1075                    Formula = "x1 * x2 / (b1 + b2 * x1 + b3 * x1 * x2 + b4 * x1 *x3)";
1076                    break;
1077                case 26:
1078                    FormulaShow = "b1 + b2 * b3 ** x";
1079                    Formula = "b1 + b2 * b3 ** x1";
1080                    break;
1081                case 27:
1082                    FormulaShow = "b1 * cos(x + b2) + b3 * cos(2 * x + b2) + b4";
1083                    Formula = "b1 * cos(x1 + b2) + b3 * cos(2 * x1 + b2) + b4";
1084                    break;
1085                case 28:
1086                    FormulaShow = "b1 * cos(x + b4) + b2 * cos(2 * x + b4) + b3 * cos(3 * x + b4)";
1087                    Formula = "b1 * cos(x1 + b4) + b2 * cos(2 * x1 + b4) + b3 * cos(3 * x1 + b4)";
1088                    break;
1089                case 29:
1090                    FormulaShow = "b1 * (1 – b2 * exp(-b3 * x ** 2))";
1091                    Formula = "b1 * (1 – b2 * exp(-b3 * x1 ** 2))";
1092                    break;
1093                case 30:
1094                    FormulaShow = "b1 * exp(-b2 * exp(-b3 * x))";
1095                    Formula = "b1 * exp(-b2 * exp(-b3 * x1))";
1096                    break;
1097                case 31:
1098                    FormulaShow = "1 / (b1 + b2 * (x – b3) ** 2)";
1099                    Formula = "1 / (b1 + b2 * (x1 – b3) ** 2)";
1100                    break;
1101                case 32:
1102                    FormulaShow = "b1 * exp(-b2 / (x + b3))";
1103                    Formula = "b1 * exp(-b2 / (x1 + b3))";
1104                    break;
1105                case 33:
1106                    FormulaShow = "b1 / (1 + exp(b2 + b3 * x))";
1107                    Formula = "b1 / (1 + exp(b2 + b3 * x1))";
1108                    break;
1109                case 34:
1110                    FormulaShow = "b1 + (b2 – b1) / (1 + exp((x – b3) / b4))";
1111                    Formula = "b1 + (b2 – b1) / (1 + exp((x1 – b3) / b4))";
1112                    break;
1113                case 35:
1114                    FormulaShow = "b1 - ln(1 + b2 * exp(-b3 * x))";
1115                    Formula = "b1 - ln(1 + b2 * exp(-b3 * x1))";
1116                    break;
1117                case 36:
1118                    FormulaShow = "b1 + (b2 – b1) / (1 + exp(b4 * ln(x / b3)))";
1119                    Formula = "b1 + (b2 – b1) / (1 + exp(b4 * ln(x1 / b3)))";
1120                    break;
1121                case 37:
1122                    FormulaShow = "(b1 + b2 * x) ** b3";
1123                    Formula = "(b1 + b2 * x1) ** b3";
1124                    break;
1125                case 38:
1126                    FormulaShow = "b1 + b2 * exp(-b3 * x)";
1127                    Formula = "b1 + b2 * exp(-b3 * x1)";
1128                    break;
1129                case 39:
1130                    FormulaShow = "b1 * x / (x + b2)";
1131                    Formula = "b1 * x1 / (x1 + b2)";
1132                    break;
1133                case 40:
1134                    FormulaShow = "(b1 * b2 + b3 * x ** b4) / (b2 + x ** b4)";
1135                    Formula = "(b1 * b2 + b3 * x1 ** b4) / (b2 + x1** b4)";
1136                    break;
1137                case 41:
1138                    FormulaShow = "b1 * exp(b2 / x)";
1139                    Formula = "b1 * exp(b2 / x1)";
1140                    break;
1141                case 42:
1142                    FormulaShow = "b1 – b2 * (ln(x1 + b3) – ln(x2))";
1143                    Formula = "b1 – b2 * (ln(x1 + b3) – ln(x2))";
1144                    break;
1145                case 43:
1146                    FormulaShow = "b1 / (1 + b2 * exp(-(b3 * x + b4 * x **2 + b5 * x ** 3)))";
1147                    Formula = "b1 / (1 + b2 * exp(-(b3 * x1 + b4 * x1 **2 + b5 * x1 ** 3)))";
1148                    break;
1149                case 44:
1150                    FormulaShow = "(b1 + b2 * x + b3 * x ** 2 + b4 * x ** 3) / (b5 * x ** 3)";
1151                    Formula = "(b1 + b2 * x1 + b3 * x1 ** 2 + b4 * x1 ** 3) / (b5 * x1 ** 3)";
1152                    break;
1153                case 45:
1154                    FormulaShow = "(b1 + b2 * x + b3 * x ** 2) / (b4 * x ** 2)";
1155                    Formula = "(b1 + b2 * x1 + b3 * x1 ** 2) / (b4 * x1 ** 2)";
1156                    break;
1157                case 46:
1158                    FormulaShow = "(b1 + b2 * x) / (1 + b3 * x + b4 * x ** 2)";
1159                    Formula = "(b1 + b2 * x1) / (1 + b3 * x1 + b4 * x1 ** 2)";
1160                    break;
1161                case 47:
1162                    FormulaShow = "(b1 + b2 * x + b3 * x ** 2) / (1 + b4 * x + b5 * x ** 2)";
1163                    Formula = "(b1 + b2 * x1 + b3 * x1** 2) / (1 + b4 * x1 + b5 * x1 ** 2)";
1164                    break;
1165                case 48:
1166                    FormulaShow = "b1 / ((1 + b2 * exp(-b3 * x)) ** (1 / b4))";
1167                    Formula = "b1 / ((1 + b2 * exp(-b3 * x1)) ** (1 / b4))";
1168                    break;
1169                case 49:
1170                    FormulaShow = "b1 / (1 + b2 * exp(-b3 * x))";
1171                    Formula = "b1 / (1 + b2 * exp(-b3 * x1))";
1172                    break;
1173                case 50:
1174                    FormulaShow = "(b1 ** (1 – b2) – b3 * exp(-b4 * x)) ** (1 / (1 – b2))";
1175                    Formula = "(b1 ** (1 – b2) – b3 * exp(-b4 * x1)) ** (1 / (1 – b2))";
1176                    break;
1177                case 51:
1178                    FormulaShow = "b1 – (b2 - b1) * exp(-b3 * x ** b4)";
1179                    Formula = "b1 – (b2 - b1) * exp(-b3 * x1 ** b4)";
1180                    break;
1181                case 52:
1182                    FormulaShow = "(b1 + b2 * x + b3 * x ** 2) ** (-1)";
1183                    Formula = "(b1 + b2 * x1 + b3 * x1 ** 2) ** (-1)";
1184                    break;
1185                default:
1186            }
1187            return {
1188                "FormulaShow": FormulaShow,
1189                "Formula": Formula
1190            };
1191        },
1192        // 改变矩阵表格的列数
1193        nonlinearSelectChange: function (weightSelectVal) {
1194            var formulaShow = exports.Tool.functionFormulaType(weightSelectVal).FormulaShow;
1195            var formula = exports.Tool.functionFormulaType(weightSelectVal).Formula;
1196            var arr = [];
1197            for (var i = 0; i < formula.length; i++) {
1198                var str = 'b' + (i + 1);
1199                if (formula.indexOf(str) > -1 && $.inArray(str, arr) == -1) {
1200                    arr.push(str)
1201                }
1202            }
1203            var weightcs = '';
1204            arr.forEach(function (item, index) {
1205                weightcs += '<tr>';
1206                weightcs += '<td data-weightNum="' + i + '" style="width:108px;box-sizing:border-box;position:relative;white-space:nowrap;overflow: hidden;text-overflow: ellipsis;">b';
1207                weightcs += (index + 1);
1208                weightcs += '</td>';
1209                weightcs += '<td class="functionFormulaParam initialValue" style="width:108px;box-sizing:border-box;position:relative;white-space:nowrap;overflow: hidden;text-overflow: ellipsis;">默认1';
1210                weightcs += '</td>';
1211                weightcs += '<td class="functionFormulaParam lowerBound" style="width:108px;box-sizing:border-box;position:relative;white-space:nowrap;overflow: hidden;text-overflow: ellipsis;">';
1212                weightcs += '</td>';
1213                weightcs += '<td class="functionFormulaParam upperBound" style="width:108px;box-sizing:border-box;position:relative;white-space:nowrap;overflow: hidden;text-overflow: ellipsis;">';
1214                weightcs += '</td>';
1215                weightcs += '</tr>';
1216            });
1217            $('.nonlinearRegressions_tbody').html(weightcs);
1218            formulaShow.indexOf("x1");
1219            if (formulaShow.indexOf("x1") > -1) {
1220                $('.zibianliang').text('自变量X1').addClass('zibianliang1').next().addClass('zibianliangselect');
1221            } else {
1222                $('.zibianliang').text('自变量X').removeClass('zibianliang1').next().addClass('zibianliangselect');
1223            }
1224            if (formulaShow.indexOf("x2") > -1) {
1225                $('.zibianliang2Box').show();
1226                $('.zibianliang2').next().addClass('functionFormula zibianliangselect');
1227            } else {
1228                $('.zibianliang2Box').hide();
1229                $('.zibianliang2').next().removeClass('functionFormula zibianliangselect');
1230            }
1231            if (formulaShow.indexOf("x3") > -1) {
1232                $('.zibianliang3Box').show();
1233                $('.zibianliang3').next().addClass('functionFormula zibianliangselect');
1234            } else {
1235                $('.zibianliang3Box').hide();
1236                $('.zibianliang3').next().removeClass('functionFormula zibianliangselect');
1237            }
1238            $('.functionFormulaVal').text(formulaShow).attr("data-title", formula);
1239        },
1240        gzhLogin: function (isSojump) { //公众号登陆
1241            $("#loadshow").show();
1242            var channel = $.cookie('channelId') || 100000000;
1243            Public.PostNo(SpssauAddress.getGzhLoginUrl, {
1244                "channel": channel
1245            }, function (data) {
1246                if (data.code == 0) {
1247                    // $("#loadshow").hide();
1248                    var htmlStr = '<div class="weiXinLoginDialog">'
1249                    if (isSojump) {
1250                        htmlStr += `<div class="warning-banner">
1251            <div class="warning-title">登录方式确认</div>
1252            <div class="warning-content">
1253                检测到你曾通过<strong>「问卷星」</strong>授权进入 SPSSAU。
1254            </div>
1255            <div class="warning-highlight">
1256                当前是微信扫码登录SPSSAU,其会生成新的账号,导致账号及数据不一致。请确认登录方式。
1257            </div>
1258            <div class="action-buttons">
1259                <a href="https://www.wjx.cn" class="blue_button" target="_blank">去问卷星授权登录</a>
1260            </div>
1261        </div>`
1262                    }
1263                    htmlStr += `<div class="weiXinLoginBox">
1264        <div>微信登录</div>
1265        <div style="margin-top: 15px;">
1266            <img class="weiXinCode" src="${data.data.url}" alt="">
1267        </div>
1268        <div style="margin-top: 15px;">
1269            <p>请使用微信扫描关注公众号后登录</p>
1270            <p>“SPSSAU”</p>
1271        </div>
1272        <div style="margin-top: 50px;">
1273  
1273          <p id="noLoginResult" style="color: red;font-size: 20px;"></p>
1274        </div>
1275    </div>
1276    </div>`;
1277                    $('body').prepend(htmlStr);
1278                    // $('.weiXinCode').attr("src", data.data.url);
1279                    $('.weiXinLoginDialog').show();
1280                    var identity = data.data.identity;
1281                    getFlushgzh();
1282
1283                    function getFlushgzh() {
1284                        Public.Ajax(SpssauAddress.flushgzh, 'POST', {
1285                            "identity": identity
1286                        }, 'json', function (data) { //'https://www.spssau.com'
1287                            if (data.code == 0) {
1288                                $("#loadshow").hide();
1289                                var obj = eval(data.data);
1290                                var stringjson = JSON.stringify(data);
1291                                $.cookie('user', stringjson, {
1292                                    expires: 1,
1293                                    path: '/'
1294                                });
1295                                if ($.cookie('lodinguser')) {
1296                                    var lodinguserData = JSON.parse($.cookie('lodinguser'));
1297                                    var index = lodinguserData.indexOf(obj.username);
1298                                    if (index > -1) {
1299
1300                                    } else {
1301                                        lodinguserData.push(obj.username);
1302                                    }
1303                                    $.cookie('lodinguser', JSON.stringify(lodinguserData), {
1304                                        path: '/'
1305                                    });
1306                                } else {
1307                                    var arr = [];
1308                                    arr.push(obj.username);
1309                                    $.cookie('lodinguser', JSON.stringify(arr), {
1310                                        path: '/'
1311                                    });
1312                                }
1313                                Public.senStrg("Just_enter_the", 1);
1314                                window.location.href = 'indexs.html';
1315                                // $.ajax({ //请求历史数据并保存
1316                                //     type: 'POST',
1317                                //     url: SpssauAddress.historyList,
1318                                //     data: 0,
1319                                //     timeout: 60000,
1320                                //     dataType: 'json',
1321                                //     success: function (historyListdata) {
1322                                //         Public.senlStorage("historylistdata", JSON.stringify(historyListdata));
1323                                //         window.location.href = 'indexs.html';
1324                                //     },
1325                                //     error: function (xhr) {
1326                                //         $("#loadshow").hide();
1327                                //     }
1328                                // });
1329                            } else if (data.code == 100101) {
1330                                // window.location.href = 'login.html';
1331                                new jBox('Notice', {
1332                                    height: 48,
1333                                    content: "<img style='display: inline-block;margin:-3px 6px 0 0;' src='./images/icon/warning-circle-red.svg'>" + data.message,
1334                                    color: 'red'
1335                                });
1336                            } else if (data.code == 100102) {
1337                                setTimeout(function () {
1338                                    getFlushgzh()
1339                                }, 1000);
1340                            } else if (data.code == 100117 || data.code == 100118) {
1341                                $('#noLoginResult').text(data.message)
1342                            } else {
1343                                // new jBox('Notice', {
1344                                //     height: 48,
1345                                //     content: "<img style='display: inline-block;margin:-3px 6px 0 0;' src='./images/icon/warning-circle-red.svg'>" + data.message,
1346                                //     color: 'red'
1347                                // });
1348                            }
1349                        }, function (e) {
1350                            console.log('error 报错!');
1351                        });
1352                    };
1353                }
1354            }, function (e) {
1355                console.log('error 报错!');
1356            });
1357        },
1358        getCopyAnalysis: function () { //复制分析建议
1359            if (window.location.pathname == '/indexs.html') {
1360                // 动态添加AI图标
1361                $('.copyTable.has-ai-icon').each(function () {
1362                    if (!$(this).next('.table_ai').length) {
1363                        $(this).after('<img src="./images/icon/AI-interpret.svg" class="table_ai" style="width: 25px; margin-left: 5px; cursor: pointer;">');
1364                    }
1365                });
1366            }
1367            var CopyAnalysis = '<i class="iconfont"><input class="copyTable copyAnalysis" id="copyAnalysisId" type="button"></i>';
1368            if ($('.WordAnalysis').find('.copyAnalysis').length == 0) {
1369                $('.WordAnalysis>.icon').append(CopyAnalysis);
1370            }
1371
1372            $('.copyAnalysis').on('click', function (e) {
1373                $(this).parents('.WordAnalysis').attr('id', 'copyAnalysis').siblings('#copyAnalysis').removeAttr('id');
1374                selectText('copyAnalysis');
1375            })
1376
1377            function selectText(thisId) {
1378                var doc = document;
1379                var element = doc.getElementById(thisId);
1380                if (doc.body.createTextRange) {
1381                    var range = document.body.createTextRange();
1382                    range.moveToElementText(element);
1383                    range.setStartAfter(element.firstChild);
1384                    range.select();
1385                } else if (window.getSelection) {
1386                    var selection = window.getSelection();
1387                    var range = document.createRange();
1388                    range.selectNodeContents(element);
1389                    range.setStartAfter(element.firstChild);
1390                    selection.removeAllRanges();
1391                    selection.addRange(range);
1392                }
1393                document.execCommand("Copy"); // 执行浏览器复制命令
1394            };
1395        },
1396        jspreadsheet: function (Id, data, tableWidth, columns, change, minDimensions) { //初始化table
1397            var obj = {
1398                data: data,
1399                minDimensions: [100, 100],
1400                tableOverflow: true,
1401                tableWidth: '600px',
1402                freezeColumns: 1,
1403                allowRenameColumn: false,
1404                columnSorting: false, //
1405                about: false
1406                // columnDrag: true, //禁用列拖动
1407            }
1408            if (tableWidth) {
1409                obj.tableWidth = tableWidth;
1410            }
1411            if (columns) {
1412                obj.columns = columns;
1413            }
1414            if (change) {
1415                obj.onchange = change;
1416                obj.ondeletecolumn = change;
1417            }
1418            if (minDimensions) {
1419                obj.minDimensions = minDimensions;
1420            }
1421            var mySpreadsheet = jspreadsheet(document.getElementById(Id
1421), obj);
1422            return mySpreadsheet;
1423        },
1424        getMousePos: function (event) { //鼠标实时坐标
1425            //var e = event || window.event;
1426            var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
1427            var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
1428            var x = event.pageX || event.clientX + scrollX;
1429            var y = event.pageY || event.clientY + scrollY;
1430            return {
1431                'x': x,
1432                'y': y - 75
1433            };
1434        },
1435        // 在 tool.js 的 exports.Tool 对象中添加以下方法
1436        aliyunCaptchaHandler: function (options) {
1437            var defaultOptions = {
1438                sceneId: '1eqxz4is',
1439                element: '#yzm_wrap',
1440                usernameSelector: '#username',
1441                sendCodeType: 2,
1442                changewordsSelector: '.changewords',
1443                // onVerifySuccess: function () { }, // 验证成功回调
1444                // onVerifyError: function () { }    // 验证失败回调
1445            };
1446
1447            var opts = $.extend({}, defaultOptions, options);
1448
1449            var captcha;
1450
1451            // 初始化阿里云验证码
1452            window.initAliyunCaptcha({
1453                SceneId: opts.sceneId,
1454                mode: 'popup',
1455                element: opts.element,
1456                captchaVerifyCallback: async function (captchaVerifyParam) {
1457                    // 1.向后端发起业务请求,获取验证码验证结果和业务结果
1458                    const result = await exports.Tool.sendVerifyCode($(opts.usernameSelector).val(), opts.sendCodeType, captchaVerifyParam);
1459                    // 2.构造标准返回参数
1460                    const verifyResult = {
1461                        // 验证码验证是否通过,boolean类型,必选。
1462                        captchaResult: result.code == 0,
1463                        // 业务验证是否通过,boolean类型,可选;若为无业务验证结果的场景,bizResult可以为空。
1464                        bizResult: result.code == 0,
1465                    };
1466                    return verifyResult;
1467                },
1468                onBizResultCallback: function (bizResult) {
1469                    if (bizResult === true) {
1470                        // 验证成功,启用倒计时
1471                        new jBox('Notice', {
1472                            height: 48,
1473                            content: "<img style='display:inline-block;margin:-3px 6px 0 0;' src='./images/icon/check-circle-blue.svg'>" + "验证码已发送",
1474                            color: 'green'
1475                        });
1476                        if (opts.onVerifySuccess) {
1477                            opts.onVerifySuccess();
1478                        } else {
1479                            exports.Tool.time($(opts.changewordsSelector));
1480                        }
1481                    }
1482                },
1483                getInstance: function (instance) {
1484                    captcha = instance;
1485
1486                    // 默认行为
1487                    $(opts.changewordsSelector).click(function () {
1488                        // 如果提供了自定义的 getInstance 函数,则使用它
1489                        if (opts.customGetInstance) {
1490                            opts.customGetInstance(captcha, opts);
1491                        } else {
1492                            var username = $(opts.usernameSelector).val();
1493                            if (exports.Tool.checkPhoneFormat(username)) {
1494                                captcha.show();
1495                            }
1496                        }
1497                    });
1498                },
1499                slideStyle: {
1500                    width: 360,
1501                    height: 40,
1502                },
1503                language: 'cn',
1504            });
1505        },
1506
1507        sendVerifyCode: function (phoneNumber, codeType, captchaVerifyCode) {
1508            // 返回一个 Promise,以便调用者可以获取结果
1509            return new Promise(function (resolve, reject) {
1510                Public.Ajax(SpssauAddress.getRegisterCode, 'POST', {
1511                    'username': '+86' + phoneNumber,
1512                    'businessType': codeType,
1513                    'scene': '1eqxz4is',
1514                    captchaVerifyCode
1515                }, 'json', function (data) {
1516                    resolve(data);
1517                    $("#loadshow").hide();
1518                }, function (e) {
1519                    // 网络错误时拒绝 Promise
1520                    reject(e);
1521                });
1522            });
1523        },
1524
1525        time: function (o) {
1526            var time = 60;
1527            var tid = setInterval(function () {
1528                o.text((time - 1) + '(S)').attr("disabled", true).removeClass("DoNotUseVerification");
1529                time--;
1530                if (time == 0) {
1531                    clearInterval(tid);
1532                    o.text("重发验证码").attr("disabled", false).addClass("DoNotUseVerification");
1533                }
1534            }, 1000)
1535        },
1536
1537        checkPhoneFormat: function (b) {
1538            // telReg = !!b.match(/^(0|86|17951)?(13[0-9]|14[5-9]|15[012356789]|16[67]|17[0-8]|18[0-9]|19[1589])[0-9]{8}$/)
1539            // telReg = !!b.match(/^(0|86|17951)?[0-9]{11}$/)
1540            telReg = !!b.match(/^(0|86|17951)?(13[0-9]|14[0-9]|15[0-9]|16[0134689]|17[2-9]|18[0-9]|19[0-9])[0-9]{8}$/)
1541            // emailreg = !!b.match(/^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/);
1542            if (b.length < 1) {
1543                rts = false;
1544                new jBox('Notice', {
1545                    height: 48,
1546                    content: "<img style='display: inline-block;margin:-3px 6px 0 0;' src='./images/icon/warning-circle-red.svg'>" + "手机号不能为空",
1547                    color: 'red'
1548                });
1549                // $("#loadshow").hide();
1550            } else {
1551                if (telReg) {
1552                    rts = true;
1553                } else {
1554                    rts = false
1555                    new jBox('Notice', {
1556                        height: 48,
1557                        content: "<img style='display: inline-block;margin:-3px 6px 0 0;' src='./images/icon/warning-circle-red.svg'>" + "手机号格式不正确",
1558                        color: 'red'
1559                    });
1560                }
1561            }
1562            return rts;
1563        },
1564
1565        checkVerifyCodeFormat: function (b) {
1566            var rt = false;
1567            if (b.length < 1) {
1568                rt = false;
1569                new jBox('Notice', {
1570                    height: 48,
1571                    content: "<img style='display: inline-block;margin:-3px 6px 0 0;' src='./images/icon/warning-circle-red.svg'>" + "验证码不能为空",
1572                    color: 'red'
1573                });
1574                // $("#loadshow").hide();
1575            } else {
1576                rt = true;
1577            }
1578            return rt;
1579        },
1580
1581        checkoutPasswordFormat: function (b) {
1582            var rt = false;
1583            if (b.length < 1) {
1584                rt = false;
1585                new jBox('Notice', {
1586                    height: 48,
1587                    content: "<img style='display: inline-block;margin:-3px 6px 0 0;' src='./images/icon/warning-circle-red.svg'>" + "密码不能为空",
1588                    color: 'red'
1589                });
1590                // $("#loadshow").hide();
1591            } else {
1592                if (!/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z._]{6,18}$/.test(b)) {
1593                    rt = false
1594                    new jBox('Notice', {
1595                        height: 48,
1596                        content: "<img style='display: inline-block;margin:-3px 6px 0 0;' src='./images/icon/warning-circle-red.svg'>" + "密码格式不正确,请输入6-18位字母加数字组合",
1597                        color: 'red'
1598                    });
1599                    // $("#loadshow").hide();
1600                } else {
1601                    rt = true;
1602                }
1603            }
1604            return rt;
1605        },
1606
1607        saveFlag: false
1608    };
1609
1610});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.