zhouwx
2024-08-16 55f821ecb4b61bda2e4308b0a04b5ec0d767b31e
src/views/onlineEducation/classBatch/index.vue
@@ -16,26 +16,21 @@
        range-separator="至"
        start-placeholder="开始日期"
        end-placeholder="结束日期"
        value-format="yyyy-MM-DD"
        style="margin-left: 40px;"
        format="yyyy-MM-dd"
        style="margin-left: 30px;"
      >
      </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-input size="small" style="margin-left: 30px;width: 200px" v-model="queryParams.trainOrgName" placeholder="请输入机构"></el-input>
      <el-button
        size="small"
        type="primary"
@@ -54,9 +49,9 @@
      <el-table-column label="ID" align="center" prop="id" />
      <el-table-column label="批次名称" align="center" prop="batchName" />
      <el-table-column label="推送平台" align="center" prop="institutionName" />
      <el-table-column label="开始时间" align="center" prop="startTime" />
      <el-table-column label="计划结束时间" align="center" prop="endTime" />
      <el-table-column label="类别" align="center" prop="category" />
      <el-table-column label="开始时间" align="center" prop="actualStartTime" />
      <el-table-column label="计划结束时间" align="center" prop="actualEndTime" />
      <el-table-column label="类别" align="center" prop="subjectCode" />
      <el-table-column label="上报时间" align="center" prop="createTime" />
      <el-table-column label="所属培训机构" align="center" prop="trainOrgName" />
      <el-table-column label="课程" align="center" >
@@ -119,6 +114,7 @@
import { listBatch, listQuestion } from '@/api/onlineEducation/student'
import { listPlatSelect } from '@/api/onlineEducation/plat'
import moment from 'moment/moment'
import { getSubject } from '@/api/onlineEducation/count'
export default {
  name: "nPeopleManage",
  dicts: [],
@@ -140,29 +136,16 @@
        institutionId: '',
        startTime: '',
        endTime: '',
        qualificationType: null,
        trainOrgId: null
        subjectCode: null,
        trainOrgName: ''
      },
      qualificationList: [
        {
          id: 1,
          name: '主要负责人'
        },
        {
          id: 2,
          name: '安全生产管理人员'
        },
        {
          id: 3,
          name: '特种作业人员'
        }
      ],
      subjectList: [],
      trainOrgList: []
    };
  },
  created() {
    this.setDate();
    this.getSubjectList()
    this.getList();
    this.getPlat();
  },
@@ -175,9 +158,49 @@
      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
      }
    },
    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;
    },
    getList(){
      // this.queryParams.startTime = moment(this.time[0]).format('YYYY-MM-DD')
      // this.queryParams.endTime = moment(this.time[1]).format('YYYY-MM-DD')
      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')
      }
      this.loading = true;
      listBatch( this.queryParams).then((res) => {
        if (res.code == 200) {
@@ -216,8 +239,8 @@
        institutionId: '',
        startTime: '',
        endTime: '',
        qualificationType: null,
        trainOrgId: null
        subjectCode: null,
        trainOrgName: ''
      }
      this.time = [];
      this.getList();