Commit 9865dde4560fbd7f9921187f19eba774d16e3d81

Authored by 梁保满
1 parent d01c5799

数据同步

src/views/basic/ask/analysis.vue
... ... @@ -44,7 +44,7 @@
44 44 <el-radio :label="2">导出</el-radio>
45 45 </el-radio-group>
46 46 </div>
47   - <div class="down-item">
  47 + <div class="down-item" v-show="downType == 2">
48 48 <p class="tit">选择要导出的学生</p>
49 49 <el-radio-group v-model="exportType">
50 50 <el-radio :label="1">导出全部</el-radio>
... ... @@ -53,10 +53,18 @@
53 53 </div>
54 54 </div>
55 55 <ul v-show="exportType == 2">
56   - <li v-for="item in exportStudent"></li>
  56 + <p class="export-tit">选择学生</p>
  57 + <el-table :data="exportStudent" @selection-change="handleSelectionChange" :max-height="300">
  58 + <el-table-column type="selection"></el-table-column>
  59 + <el-table-column prop="studentName" label="姓名" align="center"></el-table-column>
  60 + <el-table-column prop="classRank" label="班名" align="center"></el-table-column>
  61 + <el-table-column prop="correctRate" label="总正确率" align="center"><template slot-scope="scoped">{{
  62 + scoped.row.correctRate }}%</template></el-table-column>
  63 + </el-table>
57 64 </ul>
58 65 <div class="dialog-footer" slot="footer">
59   - <el-button size="small" type="primary" round @click="exportData">确 定</el-button>
  66 + <el-button v-show="downType == 2" size="small" type="primary" round @click="exportData(10)">导出前十</el-button>
  67 + <el-button size="small" type="primary" round @click="exportData(0)">确 定</el-button>
60 68 <el-button size="small" type="danger" round @click="cancel">取 消</el-button>
61 69 </div>
62 70 </el-dialog>
... ... @@ -91,7 +99,8 @@ export default {
91 99 diaDown: false,
92 100 downType: 1,
93 101 exportType: 1,
94   - exportStudent: []
  102 + exportStudent: [],
  103 + multipleSelection: [],
95 104 };
96 105 },
97 106 created() {
... ... @@ -116,6 +125,7 @@ export default {
116 125 this.id = JSON.parse(this.$route.query.id)
117 126 this.status = this.$route.query.status ? this.$route.query.status : 0;
118 127 this._QueryData();
  128 + this._QueryDataQuestionRank();
119 129 this.types != 3 ? this.periodDetail() : '';
120 130 },
121 131 methods: {
... ... @@ -188,9 +198,7 @@ export default {
188 198 ? this.$request.pPeriodQuestionReport
189 199 : this.type == 2 ? this.$request.phaseAnswerReport : this.$request.phaseInteractiveReport;
190 200 } else if (this.types == 3) {
191   - this.type == 1
192   - ? this.$request.pPeriodQuestionReport
193   - : this.type == 2 ? this.$request.pPhaseAnswerReport : this.$request.pPhaseInteractiveReport;
  201 + queryData = this.type == 2 ? this.$request.pPhaseAnswerReport : this.$request.pPhaseInteractiveReport;
194 202 }
195 203 } else {
196 204 if (this.types == 1) {
... ... @@ -204,13 +212,9 @@ export default {
204 212 ? this.$request.periodQuestionReport
205 213 : this.type == 2 ? this.$request.phaseAnswerReport : this.$request.phaseInteractiveReport;
206 214 } else if (this.types == 3) {
207   - queryData = this.type == 1
208   - ? this.$request.periodQuestionReport
209   - : this.type == 2 ? this.$request.cTPhaseAnswerReport : this.$request.cTPhaseInteractiveReport;
  215 + queryData = this.type == 2 ? this.$request.cTPhaseAnswerReport : this.$request.cTPhaseInteractiveReport;
210 216 }
211 217 }
212   -
213   -
214 218 if (this.types == 1) {
215 219 query.type = this.type
216 220 }
... ... @@ -238,32 +242,24 @@ export default {
238 242 let queryData;
239 243 if (this.role == "ROLE_PERSONAL") {
240 244 if (this.types == 1) {
241   - queryData = this.type == 1
242   - ? this.$request.pPeriodQuestionReport
243   - : this.$request.pPeriodStudentReport
  245 + queryData = this.$request.pPeriodStudentReport
244 246 }
245 247 else if (this.types == 2) {
246 248 queryData = this.type == 1
247   - ? this.$request.pPeriodQuestionReport
  249 + ? this.$request.pPeriodStudentReport
248 250 : this.type == 2 ? this.$request.phaseAnswerReport : this.$request.phaseInteractiveReport;
249 251 } else if (this.types == 3) {
250   - this.type == 1
251   - ? this.$request.pPeriodQuestionReport
252   - : this.type == 2 ? this.$request.pPhaseAnswerReport : this.$request.pPhaseInteractiveReport;
  252 + this.type == 2 ? this.$request.pPhaseAnswerReport : this.$request.pPhaseInteractiveReport;
253 253 }
254 254 } else {
255 255 if (this.types == 1) {
256   - queryData = this.type == 1
257   - ? this.$request.periodQuestionReport
258   - : this.$request.periodStudentReport
  256 + queryData = this.$request.periodStudentReport
259 257 } else if (this.types == 2) {
260 258 queryData = this.type == 1
261   - ? this.$request.periodQuestionReport
  259 + ? this.$request.periodStudentReport
262 260 : this.type == 2 ? this.$request.phaseAnswerReport : this.$request.phaseInteractiveReport;
263 261 } else if (this.types == 3) {
264   - queryData = this.type == 1
265   - ? this.$request.periodQuestionReport
266   - : this.type == 2 ? this.$request.cTPhaseAnswerReport : this.$request.cTPhaseInteractiveReport;
  262 + queryData = this.type == 2 ? this.$request.cTPhaseAnswerReport : this.$request.cTPhaseInteractiveReport;
267 263 }
268 264 }
269 265  
... ... @@ -301,15 +297,33 @@ export default {
301 297 changeDownType() {
302 298 this.exportType = 1
303 299 },
304   -
305   - //导出
306   - async exportData() {
  300 + handleSelectionChange(val) {
  301 + this.multipleSelection = val
  302 + },
  303 + //导出
  304 + async exportData(length) {
307 305 if (this.exportLoading == true) return;
308 306 this.exportLoading = true;
309 307 let studentIds = []
  308 + if (length) {
  309 + studentIds = this.exportStudent.slice(0, 10).map(item => {
  310 + return item.studentId
  311 + })
  312 + } else {
  313 + studentIds = this.multipleSelection.map(item => {
  314 + return item.studentId
  315 + })
  316 + }
  317 + let query = {};
  318 + if (studentIds.length == this.exportStudent.length) {
  319 + query.studentIds = []
  320 + } else if (studentIds.length > 0) {
  321 + query.studentIds = studentIds
  322 + }
310 323 const data = await this.$request.exportPeriodReport({
311 324 // periodId: this.id,
312 325 periodId: this.id[0],
  326 + ...query
313 327 });
314 328 this.exportLoading = false;
315 329 if (data) {
... ... @@ -377,7 +391,12 @@ div::-webkit-scrollbar-thumb {
377 391 }
378 392 }
379 393  
  394 +:deep(.el-dialog__body) {
  395 + padding-top: 0;
  396 +}
  397 +
380 398 .el-dialog {
  399 +
381 400 .down-item {
382 401 font-size: 15px;
383 402 margin-bottom: 10px;
... ... @@ -387,6 +406,12 @@ div::-webkit-scrollbar-thumb {
387 406 padding: 10px 0;
388 407 }
389 408 }
  409 +
  410 + .export-tit {
  411 + text-align: center;
  412 + font-size: 16px;
  413 + padding-bottom: 10px;
  414 + }
390 415 }
391 416  
392 417 .dialog-footer {
... ...
src/views/basic/ask/components/answerQustion.vue
... ... @@ -77,7 +77,7 @@ export default {
77 77 let params = {};
78 78  
79 79 if (this.types == 1) {
80   - const detail = JSON.parse(item.detail);
  80 + const detail = item.detail ? JSON.parse(item.detail) : [];
81 81 if (detail.length > optionsList.length) {
82 82 optionsList = [...detail];
83 83 }
... ...
src/views/basic/ask/list.vue
... ... @@ -16,7 +16,7 @@
16 16 <p class="btn-box">
17 17 <el-button type="primary" round @click="linkToDetail2">查看汇总报表</el-button>
18 18 </p>
19   - <div id="print-content">
  19 + <div>
20 20 <el-table :data="tableData" border :show-header="total > 0" style="width: 100%"
21 21 @selection-change="handleSelectionChange">
22 22 <el-table-column type="selection" width="40"></el-table-column>
... ... @@ -136,6 +136,7 @@ export default {
136 136 query: {
137 137 id: JSON.stringify([obj.id]),
138 138 types: types,
  139 + params: this.$route.query.params
139 140 },
140 141 });
141 142 },
... ... @@ -151,7 +152,8 @@ export default {
151 152 path: "/askAnalysis",
152 153 query: {
153 154 id: JSON.stringify(ids),
154   - types: subjectArr.length == 1 ? 2 : 3,
  155 + types: this.multipleSelection.length == 1 ? 1 : subjectArr.length == 1 ? 2 : 3,
  156 + params: this.$route.query.params
155 157 },
156 158 });
157 159 },
... ...
src/views/basic/dataSync/index.vue
... ... @@ -11,17 +11,8 @@
11 11 <p class="txt">
12 12 本功能帮助无法上网的授课端软件,将本地数据同步到云平台。
13 13 </p>
14   - <el-upload
15   - class="upload-demo"
16   - ref="upload"
17   - :action="url"
18   - :multiple="false"
19   - :with-credentials="true"
20   - :limit="1"
21   - :on-change="change"
22   - :on-success="upSuccess"
23   - :on-error="upError"
24   - >
  14 + <el-upload class="upload-demo" ref="upload" :action="url" :multiple="false" :with-credentials="true" :limit="1"
  15 + :on-change="change" :on-success="upSuccess" :on-error="upError">
25 16 <div class="btn-box">
26 17 <i class="fa fa-cloud-upload"></i>
27 18 <el-button type="primary" round>选择文件</el-button>
... ... @@ -31,26 +22,34 @@
31 22  
32 23 <div class="down-item">
33 24 <p class="h-title">数据导出至U盘</p>
34   - <p class="txt">本功能将云平台的数据导出到U盘。</p>
  25 + <p class="txt txt2">本功能将云平台的数据导出到U盘。</p>
35 26 <div class="btn-box btn-box2" v-loading="downLoading">
36   - <i class="fa fa-cloud-download" @click="downloadFile"></i>
37   - <el-button type="primary" round @click="downloadFile"
38   - >文件下载</el-button
39   - >
  27 + <p class="p1">
  28 + <el-checkbox-group v-model="type">
  29 + <el-checkbox :label="0">班级信息</el-checkbox>
  30 + <el-checkbox :label="2">备题组卷数据</el-checkbox>
  31 + <el-checkbox :label="2">报表数据</el-checkbox>
  32 + </el-checkbox-group>
  33 + </p>
  34 + <p class="p1">
  35 + <el-radio-group v-model="dateType">
  36 + <el-radio :label="0">全部</el-radio>
  37 + <el-radio :label="1">最近一个月</el-radio>
  38 + </el-radio-group>
  39 + </p>
  40 + <el-button type="primary" round @click="downloadFile">文件下载</el-button>
40 41 </div>
41 42 </div>
42 43 </div>
43 44 <el-dialog :close-on-click-modal="false" title="" :visible.sync="dialogVisible" width="300" center>
44 45 <el-result icon="success" title="上传成功"> </el-result>
45 46 <el-descriptions title="" :column="1">
46   - <el-descriptions-item label="导入答题卡数量">{{tipData.paperNum}}</el-descriptions-item>
47   - <el-descriptions-item label="导入随堂问报表数量">{{tipData.periodNum}}</el-descriptions-item>
48   - <el-descriptions-item label="导入即时测报表数量">{{tipData.examNum}}</el-descriptions-item>
  47 + <el-descriptions-item label="导入答题卡数量">{{ tipData.paperNum }}</el-descriptions-item>
  48 + <el-descriptions-item label="导入随堂问报表数量">{{ tipData.periodNum }}</el-descriptions-item>
  49 + <el-descriptions-item label="导入即时测报表数量">{{ tipData.examNum }}</el-descriptions-item>
49 50 </el-descriptions>
50 51 <span slot="footer" class="dialog-footer">
51   - <el-button type="primary" @click="dialogVisible = false"
52   - >确 定</el-button
53   - >
  52 + <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
54 53 </span>
55 54 </el-dialog>
56 55 </div>
... ... @@ -61,6 +60,7 @@ import { formatDate } from &quot;@/utils&quot;;
61 60 export default {
62 61 data() {
63 62 return {
  63 + role: "",
64 64 downLoading: false,
65 65 url: "/api_html/teaching/importData",
66 66 file: {},
... ... @@ -70,13 +70,36 @@ export default {
70 70 periodNum: 0,
71 71 examNum: 0,
72 72 },
  73 + type: [0, 1, 2],
  74 + dateType: 0
73 75 };
74 76 },
  77 + created() {
  78 + this.role =
  79 + this.$store.getters.info.showRole ||
  80 + this.$store.getters.info.permissions[0].role;
  81 + if (this.role == "ROLE_PERSONAL") {
  82 + this.url = "/api_html/personal/importData"
  83 + }
  84 + },
75 85 methods: {
76 86 async downloadFile() {
77 87 if (this.downLoading) return;
78 88 this.downLoading = true;
79   - const data = await this.$request.exportData();
  89 +
  90 + let query = {}
  91 + if (this.type.length == 3 || this.type.length == 0) {
  92 + query.type = []
  93 + } else {
  94 + query.type = this.type
  95 + }
  96 + if (this.dateType == 1) {
  97 + let times = new Date().getTime() - 30 * 24 * 60 * 60 * 1000
  98 + query.exportData = formatDate(times, "yyyy-MM-dd");
  99 + query.exportData = query.exportData.replaceAll("-", "")
  100 + }
  101 + const exportData = this.role == "ROLE_PERSONAL" ? this.$request.pExportData : this.$request.exportData
  102 + const data = await exportData();
80 103 this.downLoading = false;
81 104 console.log(data);
82 105 if (data) {
... ... @@ -138,18 +161,21 @@ export default {
138 161 padding: 50px;
139 162 display: flex;
140 163 justify-content: center;
  164 +
141 165 .down-item {
142 166 width: 400px;
143   - height:330px;
  167 + height: 330px;
144 168 border-radius: 20px;
145 169 margin: 20px;
146 170 background: #f8f8f8;
147 171 box-shadow: 2px 2px 5px #ccc;
  172 +
148 173 .h-title {
149 174 font-size: 16px;
150 175 color: #667ffd;
151 176 padding: 16px 0 16px 12px;
152 177 }
  178 +
153 179 .txt {
154 180 height: 80px;
155 181 padding: 0 20px;
... ... @@ -158,22 +184,35 @@ export default {
158 184 line-height: 24px;
159 185 text-align: center;
160 186 }
  187 +
  188 + .txt2 {
  189 + height: 60px;
  190 + }
  191 +
  192 + .p1 {
  193 + margin-bottom: 30px;
  194 + }
161 195 }
  196 +
162 197 .upload-demo {
163   - padding:0 20px 20px;
164   - :deep(.el-upload--text){
  198 + padding: 0 20px 20px;
  199 +
  200 + :deep(.el-upload--text) {
165 201 display: block;
166 202 }
167 203 }
  204 +
168 205 :deep(.el-upload) {
169 206 margin: 0 auto;
170 207 }
  208 +
171 209 .btn-box {
172 210 display: flex;
173 211 flex-direction: column;
174 212 justify-content: center;
175 213 align-items: center;
176 214 padding-bottom: 10px;
  215 +
177 216 .fa {
178 217 font-size: 80px;
179 218 color: #aeaeae;
... ... @@ -181,6 +220,7 @@ export default {
181 220 cursor: pointer;
182 221 }
183 222 }
  223 +
184 224 .btn-box {
185 225 width: 100%;
186 226 }
... ...