From 3ce64b1e0e2b9afa5de9cc8f172a30f169611b3d Mon Sep 17 00:00:00 2001
From: zhanglipeng <chinazhanglipeng@qq.com>
Date: Wed, 2 Dec 2020 09:37:17 +0800
Subject: [PATCH] =?UTF-8?q?=E8=AF=84=E4=BC=B0=E5=AD=A6=E4=B9=A0=E5=86=85?=
 =?UTF-8?q?=E5=AE=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 ruoyi-ui/src/api/benyi/assessmentcontent.js   |   8 +-
 .../src/views/benyi/assessmentstudy/index.vue | 237 ++++++++++++------
 .../ByAssessmentcontentController.java        |  10 +
 .../mapper/ByAssessmentcontentMapper.java     |   9 +
 .../service/IByAssessmentcontentService.java  |   8 +
 .../impl/ByAssessmentcontentServiceImpl.java  |  10 +
 .../benyi/ByAssessmentcontentMapper.xml       |  12 +-
 7 files changed, 209 insertions(+), 85 deletions(-)

diff --git a/ruoyi-ui/src/api/benyi/assessmentcontent.js b/ruoyi-ui/src/api/benyi/assessmentcontent.js
index 9b088c45c..05a76714e 100644
--- a/ruoyi-ui/src/api/benyi/assessmentcontent.js
+++ b/ruoyi-ui/src/api/benyi/assessmentcontent.js
@@ -17,7 +17,13 @@ export function listNoAssessmentcontentByChild(childid) {
   })
 }
 
-
+// 查询所有子节点
+export function childnote(id) {
+  return request({
+    url: '/benyi/assessmentcontent/childnote/' + id,
+    method: 'get'
+  })
+}
 
 // 查询部门下拉树结构
 export function treeselect() {
diff --git a/ruoyi-ui/src/views/benyi/assessmentstudy/index.vue b/ruoyi-ui/src/views/benyi/assessmentstudy/index.vue
index 3e1c5fb9c..9e8aaebc2 100644
--- a/ruoyi-ui/src/views/benyi/assessmentstudy/index.vue
+++ b/ruoyi-ui/src/views/benyi/assessmentstudy/index.vue
@@ -1,7 +1,7 @@
 <template>
   <div class="app-container">
-    <el-row :gutter="20" type="flex">
-      <el-col :span="8" :xs="24">
+    <el-row :gutter="20">
+      <el-col :span="4" :xs="24">
         <div class="head-container">
           <el-input
             v-model="name"
@@ -22,14 +22,69 @@
           />
         </div>
       </el-col>
-      <el-col :span="16" :xs="24">
+      <el-col :span="20" :xs="24">
         <el-card class="box-card">
           <div slot="header" class="clearfix">
             <span class="box-card-title">{{ title }}</span>
           </div>
-          <div class="text item">
-            <h3 class="box-card-title">内容</h3>
-            <div class="pad-left" v-html="note"></div>
+          <div   class="block" v-loading="loading">
+            <div class="block-item-title" v-html="note" v-show="isshow"></div>
+            <div
+              v-for="(itemOne, index) in assessmentList.filter(
+                (p) => p.parentId == queryParams.id
+              )"
+              :key="index"
+              v-show="!isshow"
+            >
+              <h2 class="block-item-title flex align-center">
+                {{ itemOne.sort }}.{{ itemOne.name }}
+              </h2>
+              <ul class="block-content">
+                <li
+                  v-for="(itemTwo, index) in assessmentList.filter(
+                    (p) => p.parentId == itemOne.id
+                  )"
+                  :key="index"
+                >
+                  <p class="block-content-title">
+                    <span class="num">{{ itemTwo.sort }}. </span
+                    >{{ itemTwo.name }}
+                  </p>
+                  <div
+                    class="checkbox-content"
+                    v-for="(itemThree, index) in assessmentList.filter(
+                      (p) => p.parentId == itemTwo.id
+                    )"
+                    :key="index"
+                  >
+                    <p class="checkbox-item flex align-center">
+                      {{ itemThree.sort }}.{{ itemThree.name }}
+                    </p>
+                    <div class="check-info" v-if="itemThree.ckbz">
+                      {{ itemThree.ckbz }}
+                      <!-- <p>男孩:身高:94.9-111.7厘米,体重:12.7-21.2公斤</p>
+                  <p>女孩:身高:94.1-111.3厘米,体重:12.3-21.5公斤</p> -->
+                    </div>
+                    <div
+                      class="checkbox-content"
+                      v-for="(itemFour, index) in assessmentList.filter(
+                        (p) => p.parentId == itemThree.id
+                      )"
+                      :key="index"
+                    >
+                      <p class="checkbox-item flex align-center">
+                        {{ itemFour.sort }}.{{ itemFour.name }}
+                      </p>
+                      <div class="check-info" v-if="itemFour.ckbz">
+                        {{ itemFour.ckbz }}
+                        <!-- <p>男孩:身高:94.9-111.7厘米,体重:12.7-21.2公斤</p>
+                  <p>女孩:身高:94.1-111.3厘米,体重:12.3-21.5公斤</p> -->
+                      </div>
+                    </div>
+                  </div>
+                </li>
+              </ul>
+            </div>
           </div>
         </el-card>
       </el-col>
@@ -40,8 +95,9 @@
 <script>
 import {
   treeselectstudy,
+  childnote,
   getAssessmentcontent,
-  getAssessmentcontentbyparentid
+  getAssessmentcontentbyparentid,
 } from "@/api/benyi/assessmentcontent";
 import { listAssessmentintroduce } from "@/api/benyi/assessmentintroduce";
 
@@ -49,30 +105,34 @@ export default {
   name: "Assessmentstudy",
   data() {
     return {
-      // 一日流程名称
+      // 遮罩层
+      loading: true,
+      // 名称
       name: undefined,
       //标题
       title: "儿童学习与发展评估介绍",
       //目的
       note: "",
+      isshow: true,
       // 树状显示类型
       treeOptions: [],
+      assessmentList: [],
       // 树结构
       defaultProps: {
         children: "children",
-        label: "label"
+        label: "label",
       },
       // 查询参数
       queryParams: {
-        id: undefined
-      }
+        id: undefined,
+      },
     };
   },
   watch: {
     // 根据名称筛选部门树
     name(val) {
       this.$refs.tree.filter(val);
-    }
+    },
   },
   created() {
     this.getTreeselect();
@@ -81,7 +141,7 @@ export default {
   methods: {
     /** 查询部门下拉树结构 */
     getTreeselect() {
-      treeselectstudy().then(response => {
+      treeselectstudy().then((response) => {
         this.treeOptions = response.data;
       });
     },
@@ -96,89 +156,44 @@ export default {
       this.title = data.label;
       if (data.id == "-1") {
         this.getNote();
+        this.isshow = true;
       } else {
         this.queryParams.id = data.id;
         this.getTaskList();
+        this.isshow = false;
       }
     },
     /**查询评估介绍 */
     getNote() {
-      listAssessmentintroduce(null).then(response => {
+      this.loading = true;
+      listAssessmentintroduce(null).then((response) => {
         // console.log("评估介绍:" + response.rows[0].content);
         this.note = response.rows[0].content;
+        this.loading = false;
       });
     },
-    /** 查询一日流程任务列表 */
+    /** 查询任务列表 */
     getTaskList() {
-      getAssessmentcontentbyparentid(this.queryParams.id).then(response => {
-        var tmp = "";
-        response.data.forEach(element => {
-          tmp = tmp + element.sort + ". " + element.name + "</br>";
-        });
-        this.note = tmp;
+      // console.log("id" + this.queryParams.id);
+      // getAssessmentcontentbyparentid(this.queryParams.id).then((response) => {
+      //   var tmp = "";
+      //   response.data.forEach((element) => {
+      //     tmp = tmp + element.sort + ". " + element.name + "</br>";
+      //   });
+      //   this.note = tmp;
+      // });
+      this.loading = true;
+      childnote(this.queryParams.id).then((res) => {
+        // console.log(res.data.length);
+        // console.log("id" + this.queryParams.id);
+        this.assessmentList = res.data;
+        this.loading = false;
       });
-    }
-  }
+    },
+  },
 };
 </script>
 <style lang="scss" scoped>
-.text {
-  font-size: 14px;
-}
-
-.item {
-  margin-bottom: 18px;
-  line-height: 22px;
-}
-
-.clearfix:before,
-.clearfix:after {
-  display: table;
-  content: "";
-}
-.clearfix:after {
-  clear: both;
-}
-.box-card-title {
-  display: flex;
-  align-items: center;
-  font-size: 16px;
-  &::before {
-    content: "";
-    margin-right: 8px;
-    width: 4px;
-    height: 16px;
-    background: #1890ff;
-  }
-  &.mr {
-    margin: 10px 0;
-  }
-}
-.box-card-case {
-  margin: 0;
-  font-size: 14px;
-  font-weight: 700;
-  display: flex;
-  align-items: center;
-  &::before {
-    content: "";
-    margin-right: 8px;
-    width: 4px;
-    height: 14px;
-    background: #2c3e50;
-  }
-  &.mr {
-    margin: 10px 0;
-  }
-}
-.box-card-info {
-  font-size: 14px;
-  font-weight: 700;
-}
-.pad-left {
-  padding-left: 15px;
-}
-
 // 禁止复制
 div {
   -webkit-touch-callout: none;
@@ -188,7 +203,7 @@ div {
   -ms-user-select: none;
   user-select: none;
 }
-.el-tree{
+.el-tree {
   max-height: calc(100vh - 180px);
   overflow-y: auto;
 }
@@ -196,4 +211,64 @@ div {
   max-height: calc(100vh - 130px);
   overflow-y: auto;
 }
+.block {
+  padding: 10px;
+  color: #333;
+  .block-item-title {
+    padding: 10px 0;
+    margin: 0;
+    font-size: 16px;
+    font-weight: 500;
+    &::before {
+      content: "";
+      margin-right: 8px;
+      width: 4px;
+      height: 14px;
+      background: #1890ff;
+    }
+  }
+
+  .block-content {
+    border-radius: 5px;
+    padding: 10px;
+    background: #fcfcfc;
+    .block-content-title {
+      font-size: 14px;
+      font-weight: bold;
+      line-height: 24px;
+      padding-bottom: 5px;
+      .num {
+        font-size: 16px;
+      }
+    }
+    .checkbox-content {
+      padding-left: 20px;
+      margin-bottom: 15px;
+    }
+    .checkbox-item {
+      font-size: 14px;
+      line-height: 22px;
+    }
+    .check-info {
+      line-height: 18px;
+      font-size: 12px;
+      color: #999;
+      p {
+        padding-left: 10px;
+      }
+    }
+    .el-checkbox {
+      display: flex;
+      white-space: normal;
+      .el-checkbox__input {
+        margin-top: 2px;
+      }
+    }
+  }
+}
+@media (max-width: 768.98px) {
+  .title span {
+    font-size: 12px;
+  }
+}
 </style>
diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByAssessmentcontentController.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByAssessmentcontentController.java
index dc7c732b2..6574cef3e 100644
--- a/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByAssessmentcontentController.java
+++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByAssessmentcontentController.java
@@ -70,6 +70,16 @@ public class ByAssessmentcontentController extends BaseController {
         return AjaxResult.success(byAssessmentcontentService.buildByAssessmentcontentTreeSelect(list));
     }
 
+    /**
+     * 查询评估内容列表 根据id
+     */
+    @PreAuthorize("@ss.hasPermi('benyi:assessmentcontent:list')")
+    @GetMapping("/childnote/{id}")
+    public AjaxResult childnote(@PathVariable("id") Long id) {
+        List<ByAssessmentcontent> list = byAssessmentcontentService.selectChildNodeByParentid(id);
+        return AjaxResult.success(list);
+    }
+
     /**
      * 获取评估内容详细信息
      */
diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/mapper/ByAssessmentcontentMapper.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/mapper/ByAssessmentcontentMapper.java
index dd352b50a..af768e983 100644
--- a/ruoyi/src/main/java/com/ruoyi/project/benyi/mapper/ByAssessmentcontentMapper.java
+++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/mapper/ByAssessmentcontentMapper.java
@@ -106,4 +106,13 @@ public interface ByAssessmentcontentMapper {
      * @return 结果
      */
     public List<ByAssessmentcontent> selectNodeByid(Long id);
+
+    /**
+     * 节点根据id
+     *
+     * @param id 内容ID
+     * @return 结果
+     */
+    public List<ByAssessmentcontent> selectChildNodeByParentid(Long id);
+
 }
diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/service/IByAssessmentcontentService.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/service/IByAssessmentcontentService.java
index 00c47db22..960ca11aa 100644
--- a/ruoyi/src/main/java/com/ruoyi/project/benyi/service/IByAssessmentcontentService.java
+++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/service/IByAssessmentcontentService.java
@@ -123,4 +123,12 @@ public interface IByAssessmentcontentService {
      * @return 结果
      */
     public List<ByAssessmentcontent> selectNodeByid(Long id);
+
+    /**
+     * 节点根据id
+     *
+     * @param id 内容ID
+     * @return 结果
+     */
+    public List<ByAssessmentcontent> selectChildNodeByParentid(Long id);
 }
diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/service/impl/ByAssessmentcontentServiceImpl.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/service/impl/ByAssessmentcontentServiceImpl.java
index cf5849dea..5d47f22df 100644
--- a/ruoyi/src/main/java/com/ruoyi/project/benyi/service/impl/ByAssessmentcontentServiceImpl.java
+++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/service/impl/ByAssessmentcontentServiceImpl.java
@@ -246,4 +246,14 @@ public class ByAssessmentcontentServiceImpl implements IByAssessmentcontentServi
         return byAssessmentcontentMapper.selectNodeByid(id);
     }
 
+    /**
+     * 节点根据id
+     *
+     * @param id 内容ID
+     * @return 结果
+     */
+    @Override
+    public List<ByAssessmentcontent> selectChildNodeByParentid(Long id){
+        return byAssessmentcontentMapper.selectChildNodeByParentid(id);
+    }
 }
diff --git a/ruoyi/src/main/resources/mybatis/benyi/ByAssessmentcontentMapper.xml b/ruoyi/src/main/resources/mybatis/benyi/ByAssessmentcontentMapper.xml
index e6331f388..331d2aa44 100644
--- a/ruoyi/src/main/resources/mybatis/benyi/ByAssessmentcontentMapper.xml
+++ b/ruoyi/src/main/resources/mybatis/benyi/ByAssessmentcontentMapper.xml
@@ -42,11 +42,11 @@ select -1 as id, -2 as parentId, title as name, 'N' as iselement, 0 as sort  fro
 union all
 select dict_value,-1,dict_label,'N', 0 from sys_dict_data where dict_type='sys_dm_pgyssyfw'
 union all
-select id,parentId,name,iselement,sort from by_assessmentcontent where scope=1 and parentId!=0 and iselement='N'
+select id,parentId,name,iselement,sort from by_assessmentcontent where scope=1 and parentId=1 and iselement='N'
 union all
-select id,parentId,name,iselement,sort from by_assessmentcontent where scope=2 and parentId!=0 and iselement='N'
+select id,parentId,name,iselement,sort from by_assessmentcontent where scope=2 and parentId=2 and iselement='N'
 union all
-select id,parentId,name,iselement,sort from by_assessmentcontent where scope=3 and parentId!=0 and iselement='N'
+select id,parentId,name,iselement,sort from by_assessmentcontent where scope=3 and parentId=3 and iselement='N'
 ) t
 order by t.sort
     </select>
@@ -79,6 +79,12 @@ where find_in_set(id, getChildLst(#{id})) ;
 where find_in_set(id, getChildLst(#{id})) and parentId>#{id} and iselement='N' order by id;
 	</select>
 
+    <!--根据节点id获取领域目标-->
+    <select id="selectChildNodeByParentid" parameterType="Long" resultMap="ByAssessmentcontentResult">
+		select id, parentId, name, iselement, scope, create_time, sort, ckbz  from by_assessmentcontent
+where find_in_set(id, getChildLst(#{id})) and id!=#{id} order by id;
+	</select>
+
     <!--根据幼儿id获取未评选的指标-->
     <select id="selectNoByAssessmentcontentListByChild" parameterType="Long" resultMap="ByAssessmentcontentResult">
 		SELECT id, parentId, name, iselement, scope, create_time, sort, ckbz, jyjy  FROM by_assessmentcontent