Parcourir la source

Merge branch 'leb-web-dev' of http://192.168.1.43:3000/v3/v3-lab-web into leb-web-dev

dedsudiyu il y a 8 mois
Parent
commit
c7da64a84d

+ 13 - 0
src/views/safetyCheck/dataStatistics/inspectStatistics.vue

@@ -65,6 +65,9 @@
             </el-form-item>
           </el-form>
         </div>
+        <div class="num-data-box">
+          共搜索4条数据
+        </div>
         <div class="page-content-box" style="padding-top:0;">
           <el-table class="table-box" v-loading="loading" border :data="dataList" @selection-change="handleSelectionChange" :row-key="getRowKeys">
             <el-table-column type="selection" width="50" :reserve-selection="true" align="center"/>
@@ -361,4 +364,14 @@ export default {
     }
   }
 }
+.num-data-box{
+  background: rgba(1,131,250,0.2);
+  color:#0183FA;
+  font-size:14px;
+  line-height:40px;
+  padding:0 20px;
+  border-radius:4px;
+  margin:0px 20px 20px 20px;
+  width: 330px;
+}
 </style>

+ 17 - 1
src/views/safetyCheck/dataStatistics/inspectionItemsStatistics.vue

@@ -71,7 +71,7 @@
                           @pagination="getList"
               />
             </div>
-            <div class="page-content-box" style="padding-top:0;" v-if="tabsIndex==1 || tabsIndex==2">
+            <div class="page-content-box" style="padding-top:0;" v-if="tabsIndex==1">
               <el-table class="table-box" v-loading="loading" border :data="dataList" @selection-change="handleSelectionChange" :row-key="getRowKeys">
                 <el-table-column type="selection" width="50" :reserve-selection="true" align="center"/>
                 <el-table-column label="序号" type="index" width="60"/>
@@ -87,6 +87,22 @@
                           @pagination="getList"
               />
             </div>
+            <div class="page-content-box" style="padding-top:0;" v-if="tabsIndex==2">
+              <el-table class="table-box" v-loading="loading" border :data="dataList" @selection-change="handleSelectionChange" :row-key="getRowKeys">
+                <el-table-column type="selection" width="50" :reserve-selection="true" align="center"/>
+                <el-table-column label="序号" type="index" width="60"/>
+                <el-table-column label="三级检查项" prop="name"   show-overflow-tooltip/>
+                <el-table-column label="隐患数" prop="content" width="160" show-overflow-tooltip/>
+                <el-table-column label="占比" prop="content" width="160" show-overflow-tooltip/>
+              </el-table>
+              <pagination :page-sizes="[20, 30, 40, 50]"
+                          v-show="total>0"
+                          :total="total"
+                          :page.sync="queryParams.page"
+                          :limit.sync="queryParams.pageSize"
+                          @pagination="getList"
+              />
+            </div>
           </div>
         </div>
       </div>

+ 82 - 7
src/views/safetyCheck/inspectProject/inspectProjectAccording/itemCheckComponent.vue

@@ -35,11 +35,23 @@
               <p class="page-inquire-common-style-button" @click="userHandleQueryLeft" style="width:60px;margin-right:10px;">搜索</p>
               <p class="page-reset-common-style-button" @click="userResetQueryLeft" style="width:60px;margin-right:0;">重置</p>
             </el-form>
-            <el-table class="table-box" ref="leftUserTable" border :data="userTableListLeft" @selection-change="userChangeLeft" :row-key="getRowKeys">
+            <el-table border
+                      class="table-box"
+                      :data="userTableListLeft"
+                      ref="leftUserTable"
+                      :row-key="getRowKeys"
+                      default-expand-all
+                      :select-on-indeterminate="false"
+                      @select="select"
+                      @select-all="selectAll"
+                      @selection-change="userChangeLeft"
+                      :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
               <el-table-column v-if="editType" type="selection" width="50" :reserve-selection="true" align="center"/>
-              <el-table-column label="序号" align="center" prop="userName" show-overflow-tooltip width="150"/>
-              <el-table-column label="检查项目" align="center" prop="userNumber" show-overflow-tooltip />
+              <el-table-column label="序号" align="center" prop="code" show-overflow-tooltip width="150"/>
+              <el-table-column label="检查项目" align="center" prop="name" show-overflow-tooltip />
             </el-table>
+
+
             <pagination :page-sizes="[20, 30, 40, 50]"
                         v-show="userTotalLeft>0"
                         :total="userTotalLeft"
@@ -60,7 +72,7 @@
           <div class="dept-table-max-box">
             <el-form :model="userQueryParamsRight" class="form-box" ref="queryForm" :inline="true" label-width="50px">
               <el-form-item label="" prop="deptId">
-                <el-select v-model="userQueryParamsRight.deptId" clearable @change="userHandleQueryRight" placeholder="选择部门" style="width: 214px">
+                <el-select v-model="userQueryParamsRight.deptId" clearable @change="userHandleQueryRight" placeholder="一级检查项" style="width: 214px">
                   <el-option
                     v-for="item in deptSelectList"
                     :key="item.deptId"
@@ -82,10 +94,20 @@
               <p class="page-inquire-common-style-button" @click="userHandleQueryRight" style="width:60px;margin-right:10px;">搜索</p>
               <p class="page-reset-common-style-button" @click="userResetQueryRight" style="width:60px;margin-right:0;">重置</p>
             </el-form>
-            <el-table class="table-box" ref="rightUserTable" border :data="userTableListRight" @selection-change="userChangeRight" :row-key="getRowKeys">
+            <el-table border
+                      class="table-box"
+                      :data="userTableListRight"
+                      ref="rightUserTable"
+                      :row-key="getRowKeys"
+                      default-expand-all
+                      :select-on-indeterminate="false"
+                      @select="select"
+                      @select-all="selectAll"
+                      @selection-change="userChangeRight"
+                      :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
               <el-table-column v-if="editType" type="selection" width="50" :reserve-selection="true" align="center"/>
-              <el-table-column label="序号" align="center" prop="userName" show-overflow-tooltip width="150"/>
-              <el-table-column label="检查项目" align="center" prop="userNumber" show-overflow-tooltip />
+              <el-table-column label="序号" align="center" prop="code" show-overflow-tooltip width="150"/>
+              <el-table-column label="检查项目" align="center" prop="name" show-overflow-tooltip />
             </el-table>
             <pagination :page-sizes="[20, 30, 40, 50]"
                         v-show="userTotalRight>0"
@@ -183,6 +205,59 @@
       addUserButton(){
         this.$parent.tableButton(5)
       },
+      /**- 选择框 -**/
+      // 单选
+      select (selection, row) {
+        if (selection.some(el => { return row.id === el.id })) {
+          if (row.children) {
+            this.setChildren(row.children, true)
+          }
+        } else {
+          if (row.children) {
+            this.setChildren(row.children, false)
+          }
+        }
+      },
+      // 全选
+      selectAll (selection) {
+        const isSelect = selection.some(el => {
+          const tableDataIds = this.tableData.map(j => j.id)
+          return tableDataIds.includes(el.id)
+        })
+        const isCancel = !this.tableData.every(el => {
+          const selectIds = selection.map(j => j.id)
+          return selectIds.includes(el.id)
+        })
+        if (isSelect) {
+          selection.map(el => {
+            if (el.children) {
+              this.setChildren(el.children, true)
+            }
+          })
+        }
+        if (isCancel) {
+          this.tableData.map(el => {
+            if (el.children) {
+              this.setChildren(el.children, false)
+            }
+          })
+        }
+      },
+      setChildren (children, type) {
+        children.map(j => {
+          this.toggleSelection(j, type)
+          if (j.children) {
+            this.setChildren(j.children, type)
+          }
+        })
+      },
+      toggleSelection (row, select) {
+        if (row) {
+          this.$nextTick(() => {
+            this.$refs.multipleTable && this.$refs.multipleTable.toggleRowSelection(row, select)
+          })
+        }
+      },
       /*===================================人员选择相关===================================*/
       //查询
       userHandleQueryLeft(){