浏览代码

修改列设置

zhangxc 5 年之前
父节点
当前提交
3c7f48f621
共有 3 个文件被更改,包括 55 次插入13 次删除
  1. 15 0
      src/js/qcList.js
  2. 21 6
      src/js/qcListDept.js
  3. 19 7
      src/js/qcListPerson.js

+ 15 - 0
src/js/qcList.js

@@ -570,6 +570,9 @@ function renderColSet(pageSetList){
     }
     $("#mainBox .colSetBox .cloInfo", parent.document).html(infoStr)
    
+    $(".colTabInfoBox", parent.document).scrollTop(scrollTop)
+    scrollTop = 0
+
     bindSelectCol()
     bindColOrder()
     bindSaveColSet()
@@ -595,6 +598,7 @@ function bindSelectCol(){
     $(".toggleSelectCol", parent.document ).off("click").on("click", function(){
         const index = $(this).parent().attr("data-index")
         pageSetCopy[index].status = pageSetCopy[index].status == 1 ? 0 : 1
+        scrollTop = $(".colTabInfoBox", parent.document).scrollTop()
         renderColSet(pageSetCopy)
       
     })
@@ -608,6 +612,7 @@ function bindSelectCol(){
                 pageSetCopy[i].status = 1
             }
         }
+        scrollTop = $(".colTabInfoBox", parent.document).scrollTop()
         renderColSet(pageSetCopy)
       
     })
@@ -627,6 +632,7 @@ function bindCloseColSet(){
 }
 function bindSaveColSet(){
     $(".saveColSet", parent.document ).off("click").on("click", function(){
+        let showNumSet = 0
         let sysUserPagesetVOList = []
         for(let i = 0; i < pageSetCopy.length; i++){
             const item = pageSetCopy[i]
@@ -636,6 +642,13 @@ function bindSaveColSet(){
                     status: item.status,
                     val: item.val
                 })
+                if(item.status == 1){
+                    showNumSet++
+                }
+        }
+        if(showNumSet === 0){
+            $.alerModal({"message":'最低显示1列',type:"tip",time:'1000',isFather: true, fatherWrapper: $("#mainBox", parent.document)});  
+            return
         }
         return post(api.saveQcListPageSet,{pageType:1,sysUserPagesetVOList:sysUserPagesetVOList}).then(res =>{
             if(res.data.code == '0'){
@@ -663,6 +676,7 @@ function bindColOrder(){
             const upItem =  pageSetCopy[index]
             const upItemPre =  pageSetCopy[index-1]
             pageSetCopy.splice(index-1,2,upItem,upItemPre)
+            scrollTop = $(".colTabInfoBox", parent.document).scrollTop()
             renderColSet(pageSetCopy)
            
         }else{
@@ -678,6 +692,7 @@ function bindColOrder(){
             const downItemBack =  pageSetCopy[index + 1]
             console.log('downItem',downItem,'downItemBack',downItemBack)
             pageSetCopy.splice(index,2,downItemBack,downItem)
+            scrollTop = $(".colTabInfoBox", parent.document).scrollTop()
             renderColSet(pageSetCopy)
         }
     })

+ 21 - 6
src/js/qcListDept.js

@@ -566,6 +566,9 @@ function renderColSet(pageSetList){
     }
     $("#mainBox .colSetBox .cloInfo", parent.document).html(infoStr)
    
+    $(".colTabInfoBox", parent.document).scrollTop(scrollTop)
+    scrollTop = 0
+
     bindSelectCol()
     bindColOrder()
     bindSaveColSet()
@@ -591,6 +594,7 @@ function bindSelectCol(){
     $(".toggleSelectCol", parent.document ).off("click").on("click", function(){
         const index = $(this).parent().attr("data-index")
         pageSetCopy[index].status = pageSetCopy[index].status == 1 ? 0 : 1
+        scrollTop = $(".colTabInfoBox", parent.document).scrollTop()
         renderColSet(pageSetCopy)
       
     })
@@ -604,6 +608,7 @@ function bindSelectCol(){
                 pageSetCopy[i].status = 1
             }
         }
+        scrollTop = $(".colTabInfoBox", parent.document).scrollTop()
         renderColSet(pageSetCopy)
       
     })
@@ -623,15 +628,23 @@ function bindCloseColSet(){
 }
 function bindSaveColSet(){
     $(".saveColSet", parent.document ).off("click").on("click", function(){
+        let showNumSet = 0
         let sysUserPagesetVOList = []
         for(let i = 0; i < pageSetCopy.length; i++){
             const item = pageSetCopy[i]
-                sysUserPagesetVOList.push({
-                    name: item.name,
-                    orderNo: i,
-                    status: item.status,
-                    val: item.val
-                })
+            sysUserPagesetVOList.push({
+                name: item.name,
+                orderNo: i,
+                status: item.status,
+                val: item.val
+            })
+            if(item.status == 1){
+                showNumSet++
+            }
+        }
+        if(showNumSet === 0){
+            $.alerModal({"message":'最低显示1列',type:"tip",time:'1000',isFather: true, fatherWrapper: $("#mainBox", parent.document)});  
+            return
         }
         return post(api.saveQcListPageSet,{pageType:1,sysUserPagesetVOList:sysUserPagesetVOList}).then(res =>{
             if(res.data.code == '0'){
@@ -659,6 +672,7 @@ function bindColOrder(){
             const upItem =  pageSetCopy[index]
             const upItemPre =  pageSetCopy[index-1]
             pageSetCopy.splice(index-1,2,upItem,upItemPre)
+            scrollTop = $(".colTabInfoBox", parent.document).scrollTop()
             renderColSet(pageSetCopy)
            
         }else{
@@ -674,6 +688,7 @@ function bindColOrder(){
             const downItemBack =  pageSetCopy[index + 1]
             console.log('downItem',downItem,'downItemBack',downItemBack)
             pageSetCopy.splice(index,2,downItemBack,downItem)
+            scrollTop = $(".colTabInfoBox", parent.document).scrollTop()
             renderColSet(pageSetCopy)
         }
     })

+ 19 - 7
src/js/qcListPerson.js

@@ -566,7 +566,8 @@ function renderColSet(pageSetList){
         $("#mainBox", parent.document).append(str)
     }
     $("#mainBox .colSetBox .cloInfo", parent.document).html(infoStr)
-   
+   $(".colTabInfoBox", parent.document).scrollTop(scrollTop)
+   scrollTop = 0
     bindSelectCol()
     bindColOrder()
     bindSaveColSet()
@@ -592,6 +593,7 @@ function bindSelectCol(){
     $(".toggleSelectCol", parent.document ).off("click").on("click", function(){
         const index = $(this).parent().attr("data-index")
         pageSetCopy[index].status = pageSetCopy[index].status == 1 ? 0 : 1
+        scrollTop = $(".colTabInfoBox", parent.document).scrollTop()
         renderColSet(pageSetCopy)
       
     })
@@ -605,6 +607,7 @@ function bindSelectCol(){
                 pageSetCopy[i].status = 1
             }
         }
+        scrollTop = $(".colTabInfoBox", parent.document).scrollTop()
         renderColSet(pageSetCopy)
       
     })
@@ -627,12 +630,19 @@ function bindSaveColSet(){
         let sysUserPagesetVOList = []
         for(let i = 0; i < pageSetCopy.length; i++){
             const item = pageSetCopy[i]
-                sysUserPagesetVOList.push({
-                    name: item.name,
-                    orderNo: i,
-                    status: item.status,
-                    val: item.val
-                })
+            sysUserPagesetVOList.push({
+                name: item.name,
+                orderNo: i,
+                status: item.status,
+                val: item.val
+            })
+            if(item.status == 1){
+                showNumSet++
+            }
+        }
+        if(showNumSet === 0){
+            $.alerModal({"message":'最低显示1列',type:"tip",time:'1000',isFather: true, fatherWrapper: $("#mainBox", parent.document)});  
+            return
         }
         return post(api.saveQcListPageSet,{pageType:1,sysUserPagesetVOList:sysUserPagesetVOList}).then(res =>{
             if(res.data.code == '0'){
@@ -660,6 +670,7 @@ function bindColOrder(){
             const upItem =  pageSetCopy[index]
             const upItemPre =  pageSetCopy[index-1]
             pageSetCopy.splice(index-1,2,upItem,upItemPre)
+            scrollTop = $(".colTabInfoBox", parent.document).scrollTop()
             renderColSet(pageSetCopy)
            
         }else{
@@ -675,6 +686,7 @@ function bindColOrder(){
             const downItemBack =  pageSetCopy[index + 1]
             console.log('downItem',downItem,'downItemBack',downItemBack)
             pageSetCopy.splice(index,2,downItemBack,downItem)
+            scrollTop = $(".colTabInfoBox", parent.document).scrollTop()
             renderColSet(pageSetCopy)
         }
     })