Przeglądaj źródła

frontend fix to use vue

jason.lu 6 lat temu
rodzic
commit
97c90226ce
2 zmienionych plików z 28 dodań i 101 usunięć
  1. 22 6
      js/newData.js
  2. 6 95
      lazhang.html

+ 22 - 6
js/newData.js

@@ -70,7 +70,7 @@ var DataObjectList = function(name){
     };
 
     this.addObject = function (jsonObj) {
-        this.list.push(new DataObject(ctlName, jsonObj));
+        this.list.push(new DataObject(this.ctlName, jsonObj));
     };
 
     this.assignJsonData = function (data) {
@@ -183,10 +183,10 @@ var DataObjectService = function(controlName, syncType, extparm){
             if(obj.failedCount > 100){
                 obj.failedCount = 0;
                 obj.stopTimers();
-                console.log("【错误次数过多】,暂停");
+                console.log("[排行榜返回为空git clone https://github.com/pentaho/mondrian-tck.git次数过多],暂停刷新");
             }
             if(obj.failedCount == 2) {
-                send_alert("没有数据,请尝试重新加载!【DataService】: ctlName[" + controlName + "],  extParm[" + extparm + "]");
+                send_alert("排行榜多次返回没有数据,请尝试重新加载! [" + obj.appUrl +"]");
             }
         }else{
             obj.list.assignJsonData(output.list);
@@ -269,9 +269,25 @@ RedRankTable.showPart = function(slide, part, data){
     var rpos = slide * this.slideLen + ((part+1) * this.partLen);
     var partList = [];
     for (var i = lpos; i < rpos; i++) {
-        partList[partList.length] = data.getSorted(i);
+        var one = data.getSorted(i);
+        if(one == null || one == undefined) {
+            partList[partList.length] = {passNum : 0, failNum: 0, failRate: 0, workerId: 0, fcDay: new Date().toLocaleDateString()};
+        } else {
+            partList[partList.length] = one.jsonObj;
+        }
+        partList[partList.length - 1].workerName = getUserName(partList[partList.length - 1].workerId);
+        partList[partList.length - 1].color = true;
+    }
+
+
+    let k = redrankvue.parting[part].length;
+    for(let i = 0; i < k; i++){
+        redrankvue.parting[part].pop();
+    }
+
+    for(let i = 0; i < partList.length; i++){
+        redrankvue.parting[part].push(partList[i]);
     }
-    redrankvue.part[part] = partList;
 };
 
 RedRankTable.tickInterval = 1000;
@@ -456,7 +472,7 @@ var FlowRealTime = new (function () {
 var redrankvue = new Vue({
     el: '#redrank',
     data: {
-        part:[],
+        parting:[[{},{},{},{}], [{},{},{},{}], [{},{},{},{}], [{},{},{},{}]],
         title: '本厂今日生产能手榜'
     },
     methods: {

+ 6 - 95
lazhang.html

@@ -154,7 +154,7 @@
         <div class="col-md-9 text-white" style="height: 30vh" id="redrank">
             <div class="text-center text-lg big-letter" @click="clicktitle">{{title}}</div>
             <div class="row">
-                <div class="col-md-3">
+                <div class="col-md-3" v-for="parto in parting">
                     <table class="table table-bordered text-center table-striped">
                         <thead>
                         <tr>
@@ -164,105 +164,16 @@
                             <th>不良率</th>
                         </tr>
                         </thead>
-                        <tbody id="table-rank-0" v-for="one in part[0]">
-                            <tr v-if="color">
-                                <td style="background-color:red">{{one.id}}</td>
-                                <td style="background-color:red">{{one.failNum}}}</td>
-                                <td style="background-color:red">{{one.passNum}}}</td>
-                                <td style="background-color:red">{{one.failRate}} %</td>
-                            </tr>
-                            <tr v-if="!color">
-                                <td>{{one.id}}</td>
-                                <td>{{one.failNum}}}</td>
-                                <td>{{one.passNum}}}</td>
+                        <tbody class="table-rank-0">
+                            <tr v-for="one in parto">
+                                <td>{{one.workerName}}</td>
+                                <td>{{one.failNum}}</td>
+                                <td>{{one.passNum}}</td>
                                 <td>{{one.failRate}} %</td>
                             </tr>
                         </tbody>
                     </table>
                 </div>
-
-                <div class="col-md-3">
-                    <table class="table table-bordered text-center table-striped">
-                        <thead>
-                        <tr>
-                            <th>人员</th>
-                            <th>良品</th>
-                            <th>坏品</th>
-                            <th>不良率</th>
-
-                        </tr>
-                        </thead>
-                        <tbody id="table-rank-1" v-for="one in part[1]">
-                        <tr v-if="color">
-                            <td style="background-color:red">{{one.id}}</td>
-                            <td style="background-color:red">{{one.failNum}}}</td>
-                            <td style="background-color:red">{{one.passNum}}}</td>
-                            <td style="background-color:red">{{one.failRate}} %</td>
-                        </tr>
-                        <tr v-if="!color">
-                            <td>{{one.id}}</td>
-                            <td>{{one.failNum}}}</td>
-                            <td>{{one.passNum}}}</td>
-                            <td>{{one.failRate}} %</td>
-                        </tr>
-                        </tbody>
-                    </table>
-                </div>
-                <div class="col-md-3">
-                    <table class="table table-bordered text-center table-striped">
-                        <thead>
-                        <tr>
-                            <th>人员</th>
-                            <th>良品</th>
-                            <th>坏品</th>
-                            <th>不良率</th>
-
-                        </tr>
-                        </thead>
-                        <tbody id="table-rank-2" v-for="one in part[2]">
-                        <tr v-if="color">
-                            <td style="background-color:red">{{one.id}}</td>
-                            <td style="background-color:red">{{one.failNum}}}</td>
-                            <td style="background-color:red">{{one.passNum}}}</td>
-                            <td style="background-color:red">{{one.failRate}} %</td>
-                        </tr>
-                        <tr v-if="!color">
-                            <td>{{one.id}}</td>
-                            <td>{{one.failNum}}}</td>
-                            <td>{{one.passNum}}}</td>
-                            <td>{{one.failRate}} %</td>
-                        </tr>
-                        </tbody>
-                    </table>
-                </div>
-
-                <div class="col-md-3">
-                    <table class="table table-bordered text-center table-striped">
-                        <thead>
-                        <tr>
-                            <th>人员</th>
-                            <th>良品</th>
-                            <th>坏品</th>
-                            <th>不良率</th>
-
-                        </tr>
-                        </thead>
-                        <tbody id="table-rank-3" v-for="one in part[3]">
-                        <tr v-if="color">
-                            <td style="background-color:red">{{one.id}}</td>
-                            <td style="background-color:red">{{one.failNum}}}</td>
-                            <td style="background-color:red">{{one.passNum}}}</td>
-                            <td style="background-color:red">{{one.failRate}} %</td>
-                        </tr>
-                        <tr v-if="!color">
-                            <td>{{one.id}}</td>
-                            <td>{{one.failNum}}}</td>
-                            <td>{{one.passNum}}}</td>
-                            <td>{{one.failRate}} %</td>
-                        </tr>
-                        </tbody>
-                    </table>
-                </div>
             </div>
         </div>
     </div>