From 55f821ecb4b61bda2e4308b0a04b5ec0d767b31e Mon Sep 17 00:00:00 2001
From: zhouwx <1175765986@qq.com>
Date: 星期五, 16 八月 2024 09:58:58 +0800
Subject: [PATCH] 修改

---
 src/views/onlineEducation/count/index.vue |  171 ++++++++++++++++++++++++++++++++------------------------
 1 files changed, 98 insertions(+), 73 deletions(-)

diff --git a/src/views/onlineEducation/count/index.vue b/src/views/onlineEducation/count/index.vue
index 03fb279..9a1d718 100644
--- a/src/views/onlineEducation/count/index.vue
+++ b/src/views/onlineEducation/count/index.vue
@@ -11,22 +11,33 @@
         format="yyyy-MM-dd"
       >
       </el-date-picker>
-      <el-select v-model="queryParams.qualificationType"  size="small" style="margin-left: 40px;" clearable placeholder="请选择资格类型">
-        <el-option
-          v-for="item in qualificationList"
-          :key="item.id"
-          :label="item.name"
-          :value="item.id">
-        </el-option>
-      </el-select>
-      <el-select v-model="queryParams.trainOrgId"  size="small" style="margin-left: 40px;" clearable filterable placeholder="请选择所属机构">
-        <el-option
-          v-for="item in trainOrgList"
-          :key="item.id"
-          :label="item.name"
-          :value="item.id">
-        </el-option>
-      </el-select>
+      <el-cascader
+        v-model="queryParams.subjectCode"
+        ref="classifyRef"
+        @change="changeTree"
+        :options="subjectList"
+        :props="{ checkStrictly: true }"
+        clearable
+        size="small"
+        style="margin-left: 30px;"
+      ></el-cascader>
+<!--      <el-select v-model="queryParams.subjectCode"  size="small" style="margin-left: 40px;" clearable placeholder="请选择资格类型">-->
+<!--        <el-option-->
+<!--          v-for="item in subjectList"-->
+<!--          :key="item.id"-->
+<!--          :label="item.name"-->
+<!--          :value="item.id">-->
+<!--        </el-option>-->
+<!--      </el-select>-->
+      <el-input size="small" style="margin-left: 30px;width: 200px" v-model="queryParams.trainOrgName" placeholder="请输入机构"></el-input>
+<!--      <el-select v-model="queryParams.trainOrgId"  size="small" style="margin-left: 40px;" clearable filterable placeholder="请选择所属机构">-->
+<!--        <el-option-->
+<!--          v-for="item in trainOrgList"-->
+<!--          :key="item.id"-->
+<!--          :label="item.name"-->
+<!--          :value="item.id">-->
+<!--        </el-option>-->
+<!--      </el-select>-->
       <el-button
         size="small"
         type="primary"
@@ -41,24 +52,29 @@
       >重置</el-button>
     </div>
     <el-table v-loading="loading" :data="expertList">
-      <el-table-column label="平台" align="center" prop="name" />
-      <el-table-column label="培训总人数" align="center" prop="tTotal" />
-      <el-table-column label="培训学时达标人数" align="center" prop="pTotal" />
-      <el-table-column label="考试合格人数" align="center" prop="examQualifyNum" />
-      <el-table-column label="考试合格率" align="center" prop="passRate" />
+      <el-table-column label="平台" align="center" prop="institutionName" />
+      <el-table-column label="培训总人数" align="center" prop="studentCount" />
+      <el-table-column label="培训学时达标人数" align="center" prop="finishCount" />
+      <el-table-column label="考试合格人数" align="center" prop="passCount" />
+      <el-table-column label="考试合格率" align="center" prop="passRate">
+        <template #default="scope">
+          <span>{{scope.row.passRate}}%</span>
+        </template>
+      </el-table-column>
     </el-table>
-    <pagination
-      v-show="total>0"
-      :total="total"
-      :page.sync="queryParams.pageNum"
-      :limit.sync="queryParams.pageSize"
-      @pagination="getList"
-    />
+<!--    <pagination-->
+<!--      v-show="total>0"-->
+<!--      :total="total"-->
+<!--      :page.sync="queryParams.pageNum"-->
+<!--      :limit.sync="queryParams.pageSize"-->
+<!--      @pagination="getList"-->
+<!--    />-->
   </div>
 </template>
 
 <script>
 import moment from 'moment'
+import { getCount, getSubject } from '@/api/onlineEducation/count'
 
 export default {
   name: "count",
@@ -71,46 +87,23 @@
       showSearch: true,
       addForm: false,
       total: 0,
-      objectList: [
-        {
-          value: '1',
-          label: '测试数据1'
-        },
-        {
-          value: '2',
-          label: '测试数据2'
-        },
-      ],
       expertList: [],
+      subjectList: [],
       queryParams: {
         pageNum: 1,
         pageSize: 10,
         startTime: '',
         endTime: '',
-        qualificationType: null,
-        trainOrgId: null
+        subjectCode: null,
+        trainOrgName: ''
       },
       time: [],
-      qualificationList: [
-        {
-          id: 1,
-          name: '主要负责人'
-        },
-        {
-          id: 2,
-          name: '安全生产管理人员'
-        },
-        {
-          id: 3,
-          name: '特种作业人员'
-        }
-
-      ],
       trainOrgList: []
     };
   },
   created() {
     this.setDate()
+    this.getSubjectList()
     this.getList()
   },
   methods: {
@@ -123,29 +116,61 @@
       const e = moment(end).format('YYYY-MM-DD')
       this.time = [s,e]
     },
+    changeTree(val) {
+      console.log("label====",this.$refs.classifyRef.getCheckedNodes()[0].value)
+      this.queryParams.subjectCode = this.$refs.classifyRef.getCheckedNodes()[0].value
+      // 我这里只是打印了一下label的值哦,需要赋值的话自己去赋值哦
+      if (this.$refs.classifyRef) {
+        this.$refs.classifyRef.dropDownVisible = false
+      }
+    },
     getList(){
-
-      this.queryParams.startTime = moment(this.time[0]).format('YYYY-MM-DD')
-      this.queryParams.endTime = moment(this.time[1]).format('YYYY-MM-DD')
+      // debugger
+      if(this.time && this.time.length >0){
+        this.queryParams.startTime = moment(this.time[0]).format('YYYY-MM-DD')
+        this.queryParams.endTime = moment(this.time[1]).format('YYYY-MM-DD')
+      }
       console.log('1111',this.queryParams)
       this.loading = true;
-      this.expertList = [
-        {
-          id: 1,
-          name: '链工宝',
-          organization: '测试机构1',
-          pTotal: '--',
-          tTotal: '--',
-          examQualifyNum: '--',
-          passRate: '--'
-        },
-      ]
-      this.total = 2;
+      getCount(this.queryParams).then(res => {
+        if (res.code == 200) {
+          this.expertList = res.data
+          this.loading = false;
+        }
+      })
       this.loading = false;
-
     },
     handleChange(){
 
+    },
+    getSubjectList() {
+      getSubject().then(res => {
+        if (res.code == 200) {
+         console.log('res',res)
+          this.subjectList = this.recursion(res.data)
+        }
+      })
+    },
+   recursion(data){
+      let tmp = []
+      for (let i = 0; i < data.length; i++) {
+        let item = data[i]
+        // children为空
+        if (item.children&& item.children.length==0) {
+          tmp.push({
+            value: item.code,
+            label: item.name
+          })
+          // 有children
+        } else {
+          tmp.push({
+            value: item.code,
+            label: item.name,
+            children: this.recursion(item.children)
+          })
+        }
+      }
+      return tmp;
     },
     handleQuery(){
       this.getList()
@@ -157,8 +182,8 @@
         pageSize: 10,
         startTime: '',
         endTime: '',
-        qualificationType: null,
-        trainOrgId: null
+        subjectCode: null,
+        trainOrgName: ''
       }
       this.time = []
       this.getList()

--
Gitblit v1.9.2