yuhan пре 3 месеци
родитељ
комит
2fdca47dd7
1 измењених фајлова са 19 додато и 16 уклоњено
  1. 19 16
      src/views/module_interLock/systemUser/modules/SystemUserForm.vue

+ 19 - 16
src/views/module_interLock/systemUser/modules/SystemUserForm.vue

@@ -47,18 +47,18 @@
                   <div>管理</div>
                 </span>
                 <span slot="manage" slot-scope="text, record">
-                  <!-- <span v-if="record.interlockType === '0' && !record.children">-</span> -->
-                  <!-- <a-checkbox v-else v-model="record.manage" :indeterminate="record.indeterminateManage" :disabled="model.isSystem"/> -->
-                  <a-checkbox v-model="record.manage" :indeterminate="record.indeterminateManage" :disabled="model.isSystem"/>
+                  <span v-if="record.interlockType === '0' && !record.children && !model.isSystem">-</span>
+                  <a-checkbox v-else v-model="record.manage" :indeterminate="record.indeterminateManage" :disabled="model.isSystem"/>
+                  <!-- <a-checkbox v-model="record.manage" :indeterminate="record.indeterminateManage" :disabled="model.isSystem"/> -->
                 </span>
                 <span slot="viewTitle">
                   <a-checkbox v-model="viewHeader" :indeterminate="indeterminateViewHeader" :disabled="model.isSystem" @change="changeViewHeader"/>
                   <div>查看</div>
                 </span>
                 <span slot="view" slot-scope="text, record">
-                  <!-- <span v-if="record.interlockType === '0' && !record.children">-</span> -->
-                  <!-- <a-checkbox v-else v-model="record.view" :indeterminate="record.indeterminateView" :disabled="model.isSystem"/> -->
-                  <a-checkbox v-model="record.view" :indeterminate="record.indeterminateView" :disabled="model.isSystem"/>
+                  <span v-if="record.interlockType === '0' && !record.children && !model.isSystem">-</span>
+                  <a-checkbox v-else v-model="record.view" :indeterminate="record.indeterminateView" :disabled="model.isSystem"/>
+                  <!-- <a-checkbox v-model="record.view" :indeterminate="record.indeterminateView" :disabled="model.isSystem"/> -->
                 </span>
               </a-table>
             </a-form-model-item>
@@ -255,12 +255,13 @@
           })
           // 根据装置设置总管理/查看的多选框样式
           // 设置总的管理/查看多选框样式
+          var hasSystemLength = this.tpmTreeData.filter(item => !!item.children).length
           var chooseLengthMH = this.tpmTreeData.filter(item => item.manage || (!item.manage && item.indeterminateManage)).length
-          this.indeterminateManageHeader = !!chooseLengthMH && chooseLengthMH < this.tpmTreeData.length
-          this.manageHeader = chooseLengthMH === this.tpmTreeData.length
+          this.indeterminateManageHeader = !!chooseLengthMH && chooseLengthMH < hasSystemLength
+          this.manageHeader = chooseLengthMH === hasSystemLength
           var chooseLengthVH = this.tpmTreeData.filter(item => item.view || (!item.view && item.indeterminateView)).length
-          this.indeterminateViewHeader = !!chooseLengthVH && chooseLengthVH < this.tpmTreeData.length
-          this.viewHeader = chooseLengthVH === this.tpmTreeData.length
+          this.indeterminateViewHeader = !!chooseLengthVH && chooseLengthVH < hasSystemLength
+          this.viewHeader = chooseLengthVH === hasSystemLength
 
           this.visible = true;
           this.confirmLoading = false
@@ -277,7 +278,7 @@
           for (let i = 0; i < this.tpmTreeData.length; i++) {
             // 父装置样式改变
             const element = this.tpmTreeData[i];
-            element.manage = true
+            element.manage = element.children ? true : false
             element.indeterminateManage = false
             element.view = false
             element.indeterminateView = false
@@ -312,7 +313,7 @@
           for (let i = 0; i < this.tpmTreeData.length; i++) {
             // 父装置样式改变
             const element = this.tpmTreeData[i];
-            element.view = true
+            element.view = element.children ? true : false
             element.indeterminateManage = false
             element.manage = false
             element.indeterminateView = false
@@ -469,18 +470,20 @@
               }
               // 设置总的管理/查看多选框样式
               // console.log(this.tpmTreeData)
+              var hasSystemLength = this.tpmTreeData.filter(item => !!item.children).length
+              // console.log(hasSystemLength)
               // 管理选择但没完全选择样式
               var hasChooseLengthMH = this.tpmTreeData.filter(item => item.manage || (!item.manage && item.indeterminateManage)).length
               // 管理全选样式
               var chooseAllLengthMH = this.tpmTreeData.filter(item => item.manage).length
-              this.indeterminateManageHeader = !!hasChooseLengthMH && hasChooseLengthMH <= this.tpmTreeData.length && chooseAllLengthMH !== this.tpmTreeData.length
-              this.manageHeader = chooseAllLengthMH === this.tpmTreeData.length
+              this.indeterminateManageHeader = !!hasChooseLengthMH && hasChooseLengthMH <= hasSystemLength && chooseAllLengthMH !== hasSystemLength
+              this.manageHeader = chooseAllLengthMH === hasSystemLength
               // 查看选择但没完全选择样式
               var hasChooseLengthVH = this.tpmTreeData.filter(item => item.view || (!item.view && item.indeterminateView)).length
               // 查看全选样式
               var chooseAllLengthVH = this.tpmTreeData.filter(item => item.view).length
-              this.indeterminateViewHeader = !!hasChooseLengthVH && hasChooseLengthVH <= this.tpmTreeData.length && chooseAllLengthVH !== this.tpmTreeData.length
-              this.viewHeader = chooseAllLengthVH === this.tpmTreeData.length
+              this.indeterminateViewHeader = !!hasChooseLengthVH && hasChooseLengthVH <= hasSystemLength && chooseAllLengthVH !== hasSystemLength
+              this.viewHeader = chooseAllLengthVH === hasSystemLength
             },
           },
         };