zhouwx
2024-08-22 7887434cde98de8ea5e24ea10db09d014568c79d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
<template>
  <div class="app-container">
    <div style="margin-left: -35px;margin-top: 15px">
      <el-select v-model="queryParams.institutionId"  size="small" style="margin-left: 40px;" placeholder="请选择平台">
        <el-option
          v-for="item in platformList"
          :key="item.id"
          :label="item.institutionalName"
          :value="item.id">
        </el-option>
      </el-select>
      <el-date-picker
        v-model="time"
        size="small"
        type="daterange"
        range-separator="至"
        start-placeholder="开始日期"
        end-placeholder="结束日期"
        format="yyyy-MM-dd"
        style="margin-left: 30px;"
      >
      </el-date-picker>
      <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"
        style="margin-bottom: 10px;margin-left: 20px"
        @click="handleQuery()"
      >查询</el-button>
      <el-button
        plain
        size="small"
        type="primary"
        style="margin-bottom: 10px"
        @click="resetQuery()"
      >重置</el-button>
    </div>
    <el-table v-loading="loading" :data="expertList" style="margin-top: 10px">
      <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="actualStartTime" />
      <el-table-column label="计划结束时间" align="center" prop="actualEndTime" />
      <el-table-column label="类别" align="center" prop="subjectName" />
      <el-table-column label="上报时间" align="center" prop="createTime" />
      <el-table-column label="所属培训机构" align="center" prop="trainOrgName" />
      <el-table-column label="课程" align="center" >
        <template #default="scope">
          <div v-for="(item,index) in scope.row.courseVOList" :key="index" style="color: #1890ff;cursor: pointer">
            <span @click="handleViewCourse(item)">{{item.courseName}}</span>
          </div>
        </template>
      </el-table-column>
      <el-table-column label="学员人数" align="center" prop="student" >
        <template #default="scope">
          <span style="color: #1890ff;cursor: pointer" @click="openStudent(scope.row)">{{scope.row.studentCount}}</span>
        </template>
      </el-table-column>
      <el-table-column label="是否有考试" align="center" prop="haveExam" >
        <template #default="scope">
          <span>{{scope.row.haveExam == 0 ? '否' : '是'}}</span>
        </template>
      </el-table-column>
      <el-table-column label="已开班" align="center" prop="openStatus" >
        <template #default="scope">
          <span>{{scope.row.openStatus == 0 ? '未开班' : scope.row.openStatus == 1 ? '开班' : '结束'}}</span>
        </template>
      </el-table-column>
      <el-table-column label="数据更新时间" align="center" prop="updateTime" width="100" />
      <el-table-column label="删除标记" align="center" prop="delFlag" >
        <template #default="scope">
          <span>{{scope.row.delFlag == 0 ? '未删除' : '已删除'}}</span>
        </template>
      </el-table-column>
      <el-table-column label="学时监管" align="center" class-name="small-padding fixed-width">
        <template #default="scope">
          <el-button
            size="mini"
            type="text"
            style="color: #1890ff"
            @click="openClassHour(scope.row)"
          >查看学时清单</el-button>
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
    <course-dialog ref="courseDialogRef" @getList = "getList"></course-dialog>
    <studentList ref="studentDialog" @getList = "getList"></studentList>
    <class-hour ref="classRef" @getList = "getList"></class-hour>
  </div>
</template>
 
<script>
 
import studentList from '@/views/onlineEducation/count/components/studentList.vue'
import courseDialog from '@/views/onlineEducation/courseSupervision/components/courseDialog.vue'
import classHour from '@/views/onlineEducation/classBatch/components/classHour.vue'
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: [],
  components: { courseDialog,studentList,classHour},
  data() {
    return {
      time: [],
      loading: false,
      single: true,
      multiple: true,
      showSearch: true,
      addForm: false,
      total: 0,
      platformList: [],
      expertList: [],
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        institutionId: '',
        startTime: '',
        endTime: '',
        subjectCode: null,
        trainOrgName: ''
      },
      subjectList: [],
      trainOrgList: []
    };
  },
  created() {
    this.setDate();
    this.getSubjectList()
    this.getList();
    this.getPlat();
  },
  methods: {
    setDate(){
      const end = new Date();
      const start = new Date();
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
      const s = moment(start).format('YYYY-MM-DD')
      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(){
      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) {
          this.expertList = res.rows.map(item => {
            return {
              ...item,
              trainOrgName: item.trainOrgName ? item.trainOrgName : '--',
              startTime: item.startTime ? item.startTime : '--',
              endTime: item.endTime ? item.endTime : '--',
              category: item.category ? item.category : '--'
            }
          })
          this.total = res.total
          this.loading = false;
        }
      })
    },
    getPlat() {
      listPlatSelect().then((res) => {
        if (res.code == 200) {
          this.platformList = res.data
        }
      })
    },
    handleChange(){
 
    },
    handleQuery(){
      this.getList();
 
    },
    resetQuery(){
      this.queryParams = {
        pageNum: 1,
        pageSize: 10,
        institutionId: '',
        startTime: '',
        endTime: '',
        subjectCode: null,
        trainOrgName: ''
      }
      this.time = [];
      this.getList();
    },
    handleViewCourse(data){
      this.$refs.courseDialogRef.openDialog(data,'batch');
    },
    openStudent(data) {
      this.$refs.studentDialog.openDialog(data,'batch');
    },
    openClassHour(data){
      this.$refs.classRef.openDialog(data)
 
    }
  }
};
</script>