Blame view

src/views/basic/askTestQuestion/recycle.vue 13.3 KB
f45b3c05   LH_PC   云平台新UI界面
1
2
3
4
5
6
7
8
9
10
11
12
13
  <template>
      <el-container class="default-body">
          <el-header>
              <back-box class="detailBack">
                  <template slot="title">
                      <span class="default-title">
                          查看回收站
                      </span>
                  </template>
              </back-box>
          </el-header>
          <div class="default-filter">
              <el-input v-model="query.paper" :placeholder="dataType == '1' ? '搜索课件' : '搜索试卷'"
34aad61a   刘鸿   fix:修复tag列表显示问题、分...
14
                  suffix-icon="el-icon-search" class="filter-input" clearable />
f45b3c05   LH_PC   云平台新UI界面
15
              <el-select @change="_changeClass" v-model="query.class" class="filter-select" placeholder="选择班级">
34aad61a   刘鸿   fix:修复tag列表显示问题、分...
16
                  <el-option v-for="item in classList" :key="item.classId" :label="item.className"
f45b3c05   LH_PC   云平台新UI界面
17
18
19
                      :value="item.classId" />
              </el-select>
              <el-select v-model="query.subject" placeholder="选择科目" class="filter-select">
34aad61a   刘鸿   fix:修复tag列表显示问题、分...
20
                  <el-option v-for=" item in subjectList " :key="item" :label="item" :value="item" />
f45b3c05   LH_PC   云平台新UI界面
21
22
23
24
25
26
27
28
29
30
31
32
33
34
              </el-select>
              <el-select v-if="dataType == '2'" v-model="query.tagId" placeholder="选择测验类型" class="filter-select">
                  <el-option v-for="item in typeList" :key="item.label" :label="item.label" :value="item.value" />
              </el-select>
              <el-date-picker value-format="yyyy-MM-dd" class="filter-datePicker" v-model="query.dateRange"
                  type="daterange" range-separator="-">
              </el-date-picker>
              <el-button type="primary" @click="_serach">
                  筛选
              </el-button>
          </div>
          <el-main>
              <div style='position: relative;'>
                  <el-tabs v-model="tabType" v-loading="queryLoading" type="card" class="default-tabs">
6bca489d   LH_PC   云平台二期UI
35
                      <el-tab-pane :name="'0'" :label="`我自编的(${createdCount})`">
f45b3c05   LH_PC   云平台新UI界面
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
                          <el-table class="default-table" :data="defaultList">
                              <el-table-column prop="id" label="试卷ID" width="100"></el-table-column>
                              <el-table-column prop="title" label="试卷名称"></el-table-column>
                              <el-table-column prop="tag" label="测验类型" width="200"></el-table-column>
                              <el-table-column prop="questionNum" label="总题数" width="200"></el-table-column>
                              <el-table-column prop="realName" label="创建人" width="200"></el-table-column>
                              <el-table-column prop="createdTime" label="创建时间"></el-table-column>
                              <el-table-column prop="modifiedTime" label="删除时间"></el-table-column>
                              <el-table-column prop="createdTime" label="操作">
                                  <template slot-scope="scoped">
                                      <el-button class="edit" type="text" @click="modify(scoped.row)">
                                          恢复
                                      </el-button>
                                      <el-popconfirm title="确定删除这张答题卡吗?" @confirm="remove(scoped.row)">
                                          <el-button style="color:red;margin-left: 10px;" slot="reference" class="delete"
                                              type="text">
                                              删除
                                          </el-button>
                                      </el-popconfirm>
                                  </template>
                              </el-table-column>
                          </el-table>
                      </el-tab-pane>
6bca489d   LH_PC   云平台二期UI
59
                      <el-tab-pane :name="'1'" :label="`被共享的(${sharedCount})`">
f45b3c05   LH_PC   云平台新UI界面
60
61
62
63
64
65
66
67
68
                          <el-table class="default-table" :data="sharedList">
                              <el-table-column prop="id" label="试卷ID" width="100"></el-table-column>
                              <el-table-column prop="title" label="试卷名称"></el-table-column>
                              <el-table-column prop="tag" label="测验类型" width="200"></el-table-column>
                              <el-table-column prop="questionNum" label="总题数" width="200"></el-table-column>
                              <el-table-column prop="realName" label="创建人" width="200"></el-table-column>
                              <el-table-column prop="createdTime" label="创建时间"></el-table-column>
                              <el-table-column prop="modifiedTime" label="删除时间"></el-table-column>
                              <el-table-column prop="createdTime" label="操作">
6bca489d   LH_PC   云平台二期UI
69
70
                                  <template slot-scope="scoped">
                                      <el-button class="edit" type="text" size="mini" @click="modify(scoped.row)">
f45b3c05   LH_PC   云平台新UI界面
71
72
                                          恢复
                                      </el-button>
6bca489d   LH_PC   云平台二期UI
73
                                      <el-popconfirm title="确定删除这张答题卡吗?" @confirm="remove(scoped.row)">
f45b3c05   LH_PC   云平台新UI界面
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
                                          <el-button style="color:red;margin-left: 10px;" slot="reference" class="delete"
                                              type="text" size="mini">
                                              删除
                                          </el-button>
                                      </el-popconfirm>
                                  </template>
                              </el-table-column>
                          </el-table>
                      </el-tab-pane>
                      <div slot="tab-bar">
                          <el-button type="primary" icon="el-icon-plus">新增</el-button>
                      </div>
                  </el-tabs>
  
              </div>
          </el-main>
          <el-footer class="el-footer-pagination">
              <div class="el-footer-pagination-box">
34aad61a   刘鸿   fix:修复tag列表显示问题、分...
92
93
                  <el-pagination @current-change="pageSizeChange" background layout="prev, pager, next"
                      :page-size="listPage.size" :current-page="listPage.page" :total="listPage.total">
f45b3c05   LH_PC   云平台新UI界面
94
95
96
97
98
99
                  </el-pagination>
              </div>
          </el-footer>
      </el-container>
  </template>
  <script>
6bca489d   LH_PC   云平台二期UI
100
  import { setDateRules } from "utils";
f45b3c05   LH_PC   云平台新UI界面
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
  export default {
      data() {
          return {
              dataType: "1",
              importType: 0,
              tabType: "0",
              classList: [],
              subjectList: [],
              defaultList: [],
              typeList: [],
              sharedList: [],
              query: {
                  type: 1,
                  classId: "",
                  subjectName: "",
                  tagId: "",
                  title: "",
              },
              listPage: {
                  page: 1,
                  size: 20,
                  total: 0,
              },
              query: {
                  title: "",
                  class: null,
                  subject: null,
                  dateRange: [
                      "2022-03-01", "2023-05-01"
                  ],
                  tagId: null
              },
              queryLoading: false,
              createdCount: 0,
              sharedCount: 0
          }
      },
      async created() {
          this.dataType = location.href.endsWith("askPreparationQuestionsRecycle") ? "1" : "2";
          this.role =
              this.$store.getters.info.showRole ||
              this.$store.getters.info.permissions[0].role;
  
6bca489d   LH_PC   云平台二期UI
144
          var dateRange = setDateRules('onDay');
34aad61a   刘鸿   fix:修复tag列表显示问题、分...
145
          this.query.tagId = "";
6bca489d   LH_PC   云平台二期UI
146
          this.query.dateRange = [dateRange.startDay, dateRange.endDay];
f45b3c05   LH_PC   云平台新UI界面
147
148
149
150
          await this._loadQueryDatas();
          await this._serach();
  
      },
6bca489d   LH_PC   云平台二期UI
151
152
153
154
155
156
      watch: {
          'tabType'() {
              this.listPage.page = 1;
              this._serach();
          }
      },
f45b3c05   LH_PC   云平台新UI界面
157
      methods: {
34aad61a   刘鸿   fix:修复tag列表显示问题、分...
158
159
160
161
          async pageSizeChange(value) {
              this.listPage.page = value;
              await this._serach();
          },
6bca489d   LH_PC   云平台二期UI
162
          async modify(obj) {
f45b3c05   LH_PC   云平台新UI界面
163
164
165
166
167
168
169
              //恢复答题卡
              let modifyPaper =
                  this.role == "ROLE_PERSONAL"
                      ? this.$request.pModifyPaper
                      : this.$request.modifyPaper;
              const { data, status, info } = await modifyPaper({
                  paperId: obj.id,
6bca489d   LH_PC   云平台二期UI
170
171
                  share: this.tabType == '0' ? "0" : "1",
                  status: 1
f45b3c05   LH_PC   云平台新UI界面
172
173
174
              });
              if (status == 0) {
                  let type = this.query.title ? 1 : 0;
6bca489d   LH_PC   云平台二期UI
175
                  this.$message.success(info);
f45b3c05   LH_PC   云平台新UI界面
176
177
178
179
180
181
182
183
184
185
186
187
188
                  this._serach(type);
              } else {
                  this.$message.error(info);
              }
          },
          async remove(obj) {
              //删除答题卡
              let delPaper =
                  this.role == "ROLE_PERSONAL"
                      ? this.$request.pDelPaper
                      : this.$request.delPaper;
              const { data, status, info } = await delPaper({
                  paperId: obj.id,
6bca489d   LH_PC   云平台二期UI
189
190
191
                  share: this.tabType == '0' ? "0" : "1",
                  status: 2
  
f45b3c05   LH_PC   云平台新UI界面
192
193
194
              });
              if (status == 0) {
                  let type = this.query.title ? 1 : 0;
6bca489d   LH_PC   云平台二期UI
195
                  this.$message.success(info);
f45b3c05   LH_PC   云平台新UI界面
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
                  this._serach(type);
              } else {
                  this.$message.error(info);
              }
          },
          async _changeClass() {
              await this._loadSubjectData();
          },
          async _loadSubjectData() {
              const fetchSubject =
                  this.role == "ROLE_BANZHUREN" ? this.$request.cTSubjectList :
                      this.role == "ROLE_PERSONAL" ? this.$request.pSubjectList : this.$request.tSubjectList;
  
              const { data, status, info } = await fetchSubject({
                  classId: this.query.class,
              });
  
              if (status != 0) {
                  this.$message.error(info);
                  return;
              }
              this.subjectList = data?.subjectNames ?? [];
              this.query.subject = data?.subjectNames[0] ?? "";
          },
34aad61a   刘鸿   fix:修复tag列表显示问题、分...
220
          async _loadTypes(queryParams) {
f45b3c05   LH_PC   云平台新UI界面
221
222
223
224
225
226
              let fetchTypeNames =
                  this.role == "ROLE_PERSONAL"
                      ? this.$request.pPaperTagList
                      : this.$request.fetchTypeNames;
  
              const { data, status, info } = await fetchTypeNames({
34aad61a   刘鸿   fix:修复tag列表显示问题、分...
227
228
                  ...queryParams,
                  status: queryParams.type,
f45b3c05   LH_PC   云平台新UI界面
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
                  type: 0,
              });
              if (status != 0) {
                  this.$message.error(info);
                  return;
              }
              this.typeList =
                  data.list.map((item) => {
                      return {
                          value: item.tagId,
                          label: item.tag,
                      };
                  }) || [];
              this.typeList.unshift({
                  value: "",
                  label: "请选择标签",
              });
f45b3c05   LH_PC   云平台新UI界面
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
          },
          async _loadClassData() {
              const fetchClassList =
                  this.role == "ROLE_BANZHUREN" ? this.$request.cTClassList :
                      this.role == "ROLE_PERSONAL" ? this.$request.pClassList : this.$request.tClassList;
  
              const { data, status, info } = await fetchClassList();
  
              if (status != 0) {
                  this.$message.error(info);
                  return;
              }
  
              this.classList = data?.list ?? [];
  
              this.query.class = this.classList[0]?.classId
          },
          async _loadQueryDatas() {
              this.$loading.open();
              await this._loadClassData();
              await this._loadSubjectData();
f45b3c05   LH_PC   云平台新UI界面
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
              this.$loading.close();
              await this._serach();
          },
          async _serach() {
              this.queryLoading = true;
  
              let fetchPaperList =
                  this.role == "ROLE_PERSONAL"
                      ? this.$request.pPaperList
                      : this.$request.fetchPaperList;
  
              var queryParams = {
                  classId: "",
                  subjectName: "",
                  tagId: "",
                  title: "",
                  type: this.dataType, //试卷类型
                  share: this.tabType, //分享类型
              };
  
              queryParams.classId = this.query.class;
              queryParams.subjectName = this.query.subject;
              queryParams.tagId = this.query.tagId;
              queryParams.title = this.query.paper;
34aad61a   刘鸿   fix:修复tag列表显示问题、分...
291
292
293
294
295
296
              if (this.query?.dateRange?.length >= 2) {
                  queryParams.start = this.query.dateRange[0] ?? "";
                  queryParams.end = this.query.dateRange[1] ?? "";
              }
              console.log(queryParams)
              if (this.dataType == "2") await this._loadTypes(queryParams);
f45b3c05   LH_PC   云平台新UI界面
297
298
299
300
301
302
303
304
305
306
307
308
309
              const { data, status, info } = await fetchPaperList({
                  ...queryParams,
                  status: 2,
                  page: this.listPage.page,
                  size: this.listPage.size
              });
  
              if (status != 0) {
                  this.$message.error(info);
                  return;
              }
              this.queryLoading = false;
              this.createdCount = data?.myCount || 0;
6bca489d   LH_PC   云平台二期UI
310
              this.sharedCount = data?.delShare || 0;
f45b3c05   LH_PC   云平台新UI界面
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
              this.listPage.total = data.total;
              if (this.tabType == "0") {
                  this.defaultList = [];
                  if (data?.list) this.defaultList = [...data?.list];
              }
              else if (this.tabType == "1") {
                  this.sharedList = [];
                  if (data?.list) this.sharedList = [...data?.list];
              }
          },
      }
  }
  </script>
  <style>
  .el-tabs__content {
      padding-left: 20px !important;
      padding-right: 20px !important;
      padding-top: 20px !important;
  }
  </style>