Procházet zdrojové kódy

Change stuff and realtime JS made

Guichuan Yu před 6 roky
rodič
revize
1b132c64f7
3 změnil soubory, kde provedl 268 přidání a 6 odebrání
  1. 119 6
      denglu.html
  2. 122 0
      js/basic2.js
  3. 27 0
      js/getparam1.js

+ 119 - 6
denglu.html

@@ -82,9 +82,19 @@
             return i;
         }
     </script>
+    <script>
+
+        function load()
+        {
+            alert("页面已加载!");
+
+
+
+        }
+    </script>
 </head>
 
-<body class="" style="background-color: #17253f !important;" onload="startTime()">
+<body class="" style="background-color: #17253f !important;" onload="startTime() ; load()">
 <div class="text-center">
     <nav class="navbar" style="background-color: red">
         <div class="container-fluid">
@@ -97,15 +107,26 @@
     </nav>
     <div class="container-fluid" style="margin-top: 10em">
         <div class="card">
-            <h5 class="card-header">生产拉线模式</h5>
+            <h5 class="card-header">
+                <select name="select" id="pro_areaCode" >
+                <option value="120000" selected="selected">生产拉线模式</option>
+                <option value="130000">生产线一</option>
+                <option value="140000">生产线二</option>
+                <option value="150000">生产线三</option>
+            </select>
+            </h5>
+
             <div class="card-body">
                 <h5 class="card-title">您可以看到生产线内部的实时状况</h5>
                 <p class="card-text">
-                    点击下面按钮,开始一个班次
-                <br>
-                    点击下面按钮,开始一个班次
+                    <select id="period_ID">
+                        <option selected="selected">班次</option>
+                        <option value="12">上午班</option>
+                        <option value="23">下午班</option>
+                        <option value="33">晚上班</option>
+                    </select>
                 </p>
-                <a href="#" class="btn btn-primary" onclick="location.href='lazhang.html?scheduleId=8&flowId=2'">开始班次</a>
+                <a href="#" class="btn btn-primary" onclick="location.href='lazhang.html?scheduleId=8&flowId=2&'">开始班次</a>
             </div>
         </div>
         <div class="card">
@@ -118,6 +139,98 @@
         </div>
     </div>
 </div>
+
+<!-- Jquery Core Js -->
+<script src="plugins/jquery/jquery.min.js"></script>
+
+<!-- Bootstrap Core Js -->
+<script src="plugins/bootstrap/js/bootstrap.js"></script>
+
+<!-- Select Plugin Js -->
+<script src="plugins/bootstrap-select/js/bootstrap-select.js"></script>
+
+<!-- Slimscroll Plugin Js -->
+<script src="plugins/jquery-slimscroll/jquery.slimscroll.js"></script>
+
+<!-- Waves Effect Plugin Js -->
+<script src="plugins/node-waves/waves.js"></script>
+
+<!-- Jquery CountTo Plugin Js -->
+<script src="plugins/jquery-countto/jquery.countTo.js"></script>
+
+<!-- Morris Plugin Js -->
+<script src="plugins/raphael/raphael.min.js"></script>
+<script src="plugins/morrisjs/morris.js"></script>
+
+<!-- ChartJs -->
+<script src="plugins/chartjs/Chart.bundle.js"></script>
+
+<!-- Flot Charts Plugin Js -->
+<script src="plugins/flot-charts/jquery.flot.js"></script>
+<script src="plugins/flot-charts/jquery.flot.resize.js"></script>
+<script src="plugins/flot-charts/jquery.flot.pie.js"></script>
+<script src="plugins/flot-charts/jquery.flot.categories.js"></script>
+<script src="plugins/flot-charts/jquery.flot.time.js"></script>
+
+<!-- Sparkline Chart Plugin Js -->
+<script src="plugins/jquery-sparkline/jquery.sparkline.js"></script>
+<script src="js/basic2.js"></script>
+<script src="js/getparam1.js"></script>
+
+<script>
+
+    function showEachSpot1() {
+        var htmlbody = "", one_person = "";
+        var i = 0;
+        var triGap = periodID.length;
+
+        htmlbody = "";
+        for (i = 0; i < triGap; i++) {
+
+            htmlbody = getSpotHtml(htmlbody, i);
+        }
+        $("#period_ID").html(htmlbody);
+        //console.log(htmlbody);
+    }
+    function getSpotHtml1(htmlbody,  i) {
+        htmlbody += "";
+        htmlbody += `<option value="periodID[i]">
+                                           ${periodname[i]}
+
+                                        </option>`;
+        htmlbody += "";
+        return htmlbody;
+    }
+
+    var proAreaCode =$("#pro_areaCode").val();
+    var periodnum =$("#period_ID").val();
+    $(document).ready(on_document_load);
+
+    function showEachSpot() {
+        var htmlbody = "", one_person = "";
+        var i = 0;
+        var triGap = flowID.length;
+
+        htmlbody = "";
+        for (i = 0; i < triGap; i++) {
+
+            htmlbody = getSpotHtml(htmlbody, i);
+        }
+        $("#pro_areaCode").html(htmlbody);
+        //console.log(htmlbody);
+    }
+    function getSpotHtml(htmlbody,  i) {
+        htmlbody += "";
+        htmlbody += `<option value="flowID[i]">
+                                           ${flowname[i]}
+
+                                        </option>`;
+        htmlbody += "";
+        return htmlbody;
+    }
+
+
+</script>
 </body>
 
 </html>

+ 122 - 0
js/basic2.js

@@ -0,0 +1,122 @@
+var SVR_URL = "/server/";  //http://172.30.84.3:8803
+if(location.host.indexOf("niimei") === -1){
+    SVR_URL = "http://172.30.84.3:8803/server/";
+}
+
+
+function get_data(url, callback) {
+    $.ajax({
+        url: SVR_URL + url,
+        apiName: url,
+        sendTime: new Date()
+    }).done(callback).fail(on_fail);
+}
+
+function on_fail(msg) {
+    alert("很抱歉,网络错误,请查看Console");
+    console.log("-----   网络请求失败 ---------")
+    console.log(JSON.stringify(this));
+    console.log("----------------------------")
+}
+
+function on_data_success(obj, status) {
+
+}
+
+function first_parse(ajax, obj) {
+    if (typeof obj === "string") {
+        obj = JSON.parse(obj);
+    }
+
+    if (typeof obj !== "object") {
+        console.log(ajax);
+        throw "Error ! Parsing JSON failed ." + JSON.stringify(obj);
+    }
+
+    if (obj.ret == "10000" || obj.ret == 10000 || obj.ret == 1000) {
+        return obj.model;
+    } else {
+        console.log(ajax);
+        throw "Error ! Server returned error." + JSON.stringify(obj);
+    }
+}
+
+
+
+function on_document_load() {
+
+    firsttime_load_spots_data();
+    secondtime_load_spots_data();
+}
+function firsttime_load_spots_data() {
+    get_data("fcFlow/list", first_success)
+}
+var flowID=[];
+var flowname=[];
+var periodID=[];
+var periodname=[];
+function first_success(obj, sta) {
+    var output = first_parse(this, obj);
+    //在这里排序 spo\
+    console.log(" output : ");
+    console.log(output);
+    var i,j,k;
+    j=0;
+    k=0;
+    for(i=0;i<output.list.length;i++){
+        if(userId==output.list[i].flowMasterId){
+            flowID[j]=output.list[i].flowId;
+            flowname[j]=output.list[i].flowName;
+            j++;
+
+        }
+        else {
+            k++;
+        }
+
+    }
+    if(k==output.list.length-1){
+        alert("无权限访问!");
+    }
+    showEachSpot();
+    showEachSpot1();
+
+
+
+
+}
+function secondtime_load_spots_data() {
+    get_data("fcWorkPeriod/list", second_success);
+}
+function thirdtime_load_spots_data() {
+    get_data("fcWorkSchedule/list", third_success);
+}
+function second_success(obj, sta) {
+    var history = first_parse(this, obj);
+    var i, j;
+    console.log(" history : ");
+    console.log(history);
+    for(i=0;i<history.length;i++){
+        periodID[i]=history[i].periodId;
+        periodname[i]=history[i].periodName;
+
+    }
+    thirdtime_load_spots_data();
+
+
+}
+var scheduleID;
+function second_success(obj, sta) {
+    var history = first_parse(this, obj);
+    var i, j;
+    console.log(" history : ");
+    console.log(history);
+    for(i=0;i<history.list.length;i++){
+        if(flowID[i]==history.list[i].flowId&&periodID[i]==history.list[i].periodId){
+            scheduleID=history.list[i].scheduleId;
+        }
+    }
+
+
+
+}

+ 27 - 0
js/getparam1.js

@@ -0,0 +1,27 @@
+function utils_get_param(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 userId = utils_get_param("userId");
+
+if(userId == null ){
+    alert("出错啦!请检查参数完整性");
+}
+
+
+// 去除实际名字
+function getNames(workerIdList, chart){
+    // return "张三";
+
+}
+
+function on_load_name_success(obj){
+
+}
+
+function reloadPage(){
+    location.reload()
+}