Bläddra i källkod

缺陷空状态

zhouna 5 år sedan
förälder
incheckning
ef13e7c7dc
3 ändrade filer med 39 tillägg och 10 borttagningar
  1. 11 0
      src/css/qcScore.less
  2. 12 8
      src/html/qcScore.html
  3. 16 2
      src/js/qcScore.js

+ 11 - 0
src/css/qcScore.less

@@ -196,6 +196,17 @@
       height: 100%;
       overflow-y: auto;
     }
+    .empty{
+      /*display: none;*/
+      margin-top: 120px;
+      text-align: center;
+      p{
+        margin-top: 15px;
+        font-size: 12px;
+        text-indent: 10px;
+        color: #aaa;
+      }
+    }
     .flaw-item{
       display: none;
       margin: 0 20px 10px 30px ;

+ 12 - 8
src/html/qcScore.html

@@ -127,12 +127,6 @@
         </div>
     </script>
     <script type="text/html" id="flawTmpl">
-        {{if isEmpty}}
-        <div class="empty">
-            <img src="../images/empty.png" alt="空"/>
-            <p>暂无详情~</p>
-        </div>
-        {{else}}
         <div class="flaw-item" code="${modelName}">
             <div class="title">${msg}</div>
             <div class="opers">
@@ -147,7 +141,12 @@
                 </div>
             </div>
         </div>
-        {{/if}}
+    </script>
+    <script type="text/html" id="emptyTmpl">
+        <div class="empty">
+            <img src="../images/empty.png" alt="空"/>
+            <p>暂无详情~</p>
+        </div>
     </script>
     <script type="text/html" id="editTmpl">
         <div class="edit-box">
@@ -172,7 +171,12 @@
                     <span>缺陷详情</span>
                     <!--<a href="javascript:void(0);">+ 新增</a>-->
                 </div>
-                <div class="flaw-box content-ht"></div>
+                <div class="flaw-box content-ht">
+                    <!--<div class="empty">
+                        <img src="../images/empty.png" alt="空"/>
+                        <p>暂无详情~</p>
+                    </div>-->
+                </div>
             </div>
         </div>
     </div>

+ 16 - 2
src/js/qcScore.js

@@ -34,7 +34,8 @@ function initMenu(data){
     const code=$(this).attr("code");
     global_activeTab=code;
     $(".content-item,.flaw-item").hide();
-    $(".content-item[code='"+code+"'],.flaw-item[code='"+code+"']").show();
+    $(".content-item[code='"+code+"']").show();
+    showFlawList();
   });
 }
 
@@ -86,7 +87,8 @@ function initScoreItem(data){
   for(let k in data){
     $("#flawTmpl").tmpl(data[k]).appendTo("#flaws .flaw-box");
   }
-  $(".flaw-item[code="+global_activeTab+"]").show();
+  //$(".flaw-item[code="+global_activeTab+"]").show();
+  showFlawList();
   $(".flaw-item .oper a").click(function () {
     //const activeTab=$(".sub-menu .page.active").attr("code");
     const i = $(".flaw-item[code="+global_activeTab+"]").index($(this).parents(".flaw-item"));
@@ -95,6 +97,18 @@ function initScoreItem(data){
     showModal(isEdit?'0':'1',code,i);
   })
 }
+
+//显示缺陷列表
+function showFlawList(){
+  const hml = $(".flaw-item[code="+global_activeTab+"]");
+  if(hml.length){
+    hml.show();
+    $("#flaws .empty").hide();
+  }else{
+    $("#flaws .empty").length?$("#flaws .empty").show():$("#emptyTmpl").tmpl().appendTo("#flaws .flaw-box");
+  }
+}
+
 //删除评分项
 function delScore(id){
   const param={