Commit 9865dde4560fbd7f9921187f19eba774d16e3d81

Authored by 梁保满
1 parent d01c5799

数据同步

src/views/basic/ask/analysis.vue
@@ -44,7 +44,7 @@ @@ -44,7 +44,7 @@
44 <el-radio :label="2">导出</el-radio> 44 <el-radio :label="2">导出</el-radio>
45 </el-radio-group> 45 </el-radio-group>
46 </div> 46 </div>
47 - <div class="down-item"> 47 + <div class="down-item" v-show="downType == 2">
48 <p class="tit">选择要导出的学生</p> 48 <p class="tit">选择要导出的学生</p>
49 <el-radio-group v-model="exportType"> 49 <el-radio-group v-model="exportType">
50 <el-radio :label="1">导出全部</el-radio> 50 <el-radio :label="1">导出全部</el-radio>
@@ -53,10 +53,18 @@ @@ -53,10 +53,18 @@
53 </div> 53 </div>
54 </div> 54 </div>
55 <ul v-show="exportType == 2"> 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 </ul> 64 </ul>
58 <div class="dialog-footer" slot="footer"> 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 <el-button size="small" type="danger" round @click="cancel">取 消</el-button> 68 <el-button size="small" type="danger" round @click="cancel">取 消</el-button>
61 </div> 69 </div>
62 </el-dialog> 70 </el-dialog>
@@ -91,7 +99,8 @@ export default { @@ -91,7 +99,8 @@ export default {
91 diaDown: false, 99 diaDown: false,
92 downType: 1, 100 downType: 1,
93 exportType: 1, 101 exportType: 1,
94 - exportStudent: [] 102 + exportStudent: [],
  103 + multipleSelection: [],
95 }; 104 };
96 }, 105 },
97 created() { 106 created() {
@@ -116,6 +125,7 @@ export default { @@ -116,6 +125,7 @@ export default {
116 this.id = JSON.parse(this.$route.query.id) 125 this.id = JSON.parse(this.$route.query.id)
117 this.status = this.$route.query.status ? this.$route.query.status : 0; 126 this.status = this.$route.query.status ? this.$route.query.status : 0;
118 this._QueryData(); 127 this._QueryData();
  128 + this._QueryDataQuestionRank();
119 this.types != 3 ? this.periodDetail() : ''; 129 this.types != 3 ? this.periodDetail() : '';
120 }, 130 },
121 methods: { 131 methods: {
@@ -188,9 +198,7 @@ export default { @@ -188,9 +198,7 @@ export default {
188 ? this.$request.pPeriodQuestionReport 198 ? this.$request.pPeriodQuestionReport
189 : this.type == 2 ? this.$request.phaseAnswerReport : this.$request.phaseInteractiveReport; 199 : this.type == 2 ? this.$request.phaseAnswerReport : this.$request.phaseInteractiveReport;
190 } else if (this.types == 3) { 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 } else { 203 } else {
196 if (this.types == 1) { 204 if (this.types == 1) {
@@ -204,13 +212,9 @@ export default { @@ -204,13 +212,9 @@ export default {
204 ? this.$request.periodQuestionReport 212 ? this.$request.periodQuestionReport
205 : this.type == 2 ? this.$request.phaseAnswerReport : this.$request.phaseInteractiveReport; 213 : this.type == 2 ? this.$request.phaseAnswerReport : this.$request.phaseInteractiveReport;
206 } else if (this.types == 3) { 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 if (this.types == 1) { 218 if (this.types == 1) {
215 query.type = this.type 219 query.type = this.type
216 } 220 }
@@ -238,32 +242,24 @@ export default { @@ -238,32 +242,24 @@ export default {
238 let queryData; 242 let queryData;
239 if (this.role == "ROLE_PERSONAL") { 243 if (this.role == "ROLE_PERSONAL") {
240 if (this.types == 1) { 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 else if (this.types == 2) { 247 else if (this.types == 2) {
246 queryData = this.type == 1 248 queryData = this.type == 1
247 - ? this.$request.pPeriodQuestionReport 249 + ? this.$request.pPeriodStudentReport
248 : this.type == 2 ? this.$request.phaseAnswerReport : this.$request.phaseInteractiveReport; 250 : this.type == 2 ? this.$request.phaseAnswerReport : this.$request.phaseInteractiveReport;
249 } else if (this.types == 3) { 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 } else { 254 } else {
255 if (this.types == 1) { 255 if (this.types == 1) {
256 - queryData = this.type == 1  
257 - ? this.$request.periodQuestionReport  
258 - : this.$request.periodStudentReport 256 + queryData = this.$request.periodStudentReport
259 } else if (this.types == 2) { 257 } else if (this.types == 2) {
260 queryData = this.type == 1 258 queryData = this.type == 1
261 - ? this.$request.periodQuestionReport 259 + ? this.$request.periodStudentReport
262 : this.type == 2 ? this.$request.phaseAnswerReport : this.$request.phaseInteractiveReport; 260 : this.type == 2 ? this.$request.phaseAnswerReport : this.$request.phaseInteractiveReport;
263 } else if (this.types == 3) { 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,15 +297,33 @@ export default {
301 changeDownType() { 297 changeDownType() {
302 this.exportType = 1 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 if (this.exportLoading == true) return; 305 if (this.exportLoading == true) return;
308 this.exportLoading = true; 306 this.exportLoading = true;
309 let studentIds = [] 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 const data = await this.$request.exportPeriodReport({ 323 const data = await this.$request.exportPeriodReport({
311 // periodId: this.id, 324 // periodId: this.id,
312 periodId: this.id[0], 325 periodId: this.id[0],
  326 + ...query
313 }); 327 });
314 this.exportLoading = false; 328 this.exportLoading = false;
315 if (data) { 329 if (data) {
@@ -377,7 +391,12 @@ div::-webkit-scrollbar-thumb { @@ -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 .el-dialog { 398 .el-dialog {
  399 +
381 .down-item { 400 .down-item {
382 font-size: 15px; 401 font-size: 15px;
383 margin-bottom: 10px; 402 margin-bottom: 10px;
@@ -387,6 +406,12 @@ div::-webkit-scrollbar-thumb { @@ -387,6 +406,12 @@ div::-webkit-scrollbar-thumb {
387 padding: 10px 0; 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 .dialog-footer { 417 .dialog-footer {
src/views/basic/ask/components/answerQustion.vue
@@ -77,7 +77,7 @@ export default { @@ -77,7 +77,7 @@ export default {
77 let params = {}; 77 let params = {};
78 78
79 if (this.types == 1) { 79 if (this.types == 1) {
80 - const detail = JSON.parse(item.detail); 80 + const detail = item.detail ? JSON.parse(item.detail) : [];
81 if (detail.length > optionsList.length) { 81 if (detail.length > optionsList.length) {
82 optionsList = [...detail]; 82 optionsList = [...detail];
83 } 83 }
src/views/basic/ask/list.vue
@@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
16 <p class="btn-box"> 16 <p class="btn-box">
17 <el-button type="primary" round @click="linkToDetail2">查看汇总报表</el-button> 17 <el-button type="primary" round @click="linkToDetail2">查看汇总报表</el-button>
18 </p> 18 </p>
19 - <div id="print-content"> 19 + <div>
20 <el-table :data="tableData" border :show-header="total > 0" style="width: 100%" 20 <el-table :data="tableData" border :show-header="total > 0" style="width: 100%"
21 @selection-change="handleSelectionChange"> 21 @selection-change="handleSelectionChange">
22 <el-table-column type="selection" width="40"></el-table-column> 22 <el-table-column type="selection" width="40"></el-table-column>
@@ -136,6 +136,7 @@ export default { @@ -136,6 +136,7 @@ export default {
136 query: { 136 query: {
137 id: JSON.stringify([obj.id]), 137 id: JSON.stringify([obj.id]),
138 types: types, 138 types: types,
  139 + params: this.$route.query.params
139 }, 140 },
140 }); 141 });
141 }, 142 },
@@ -151,7 +152,8 @@ export default { @@ -151,7 +152,8 @@ export default {
151 path: "/askAnalysis", 152 path: "/askAnalysis",
152 query: { 153 query: {
153 id: JSON.stringify(ids), 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,17 +11,8 @@
11 <p class="txt"> 11 <p class="txt">
12 本功能帮助无法上网的授课端软件,将本地数据同步到云平台。 12 本功能帮助无法上网的授课端软件,将本地数据同步到云平台。
13 </p> 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 <div class="btn-box"> 16 <div class="btn-box">
26 <i class="fa fa-cloud-upload"></i> 17 <i class="fa fa-cloud-upload"></i>
27 <el-button type="primary" round>选择文件</el-button> 18 <el-button type="primary" round>选择文件</el-button>
@@ -31,26 +22,34 @@ @@ -31,26 +22,34 @@
31 22
32 <div class="down-item"> 23 <div class="down-item">
33 <p class="h-title">数据导出至U盘</p> 24 <p class="h-title">数据导出至U盘</p>
34 - <p class="txt">本功能将云平台的数据导出到U盘。</p> 25 + <p class="txt txt2">本功能将云平台的数据导出到U盘。</p>
35 <div class="btn-box btn-box2" v-loading="downLoading"> 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 </div> 41 </div>
41 </div> 42 </div>
42 </div> 43 </div>
43 <el-dialog :close-on-click-modal="false" title="" :visible.sync="dialogVisible" width="300" center> 44 <el-dialog :close-on-click-modal="false" title="" :visible.sync="dialogVisible" width="300" center>
44 <el-result icon="success" title="上传成功"> </el-result> 45 <el-result icon="success" title="上传成功"> </el-result>
45 <el-descriptions title="" :column="1"> 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 </el-descriptions> 50 </el-descriptions>
50 <span slot="footer" class="dialog-footer"> 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 </span> 53 </span>
55 </el-dialog> 54 </el-dialog>
56 </div> 55 </div>
@@ -61,6 +60,7 @@ import { formatDate } from &quot;@/utils&quot;; @@ -61,6 +60,7 @@ import { formatDate } from &quot;@/utils&quot;;
61 export default { 60 export default {
62 data() { 61 data() {
63 return { 62 return {
  63 + role: "",
64 downLoading: false, 64 downLoading: false,
65 url: "/api_html/teaching/importData", 65 url: "/api_html/teaching/importData",
66 file: {}, 66 file: {},
@@ -70,13 +70,36 @@ export default { @@ -70,13 +70,36 @@ export default {
70 periodNum: 0, 70 periodNum: 0,
71 examNum: 0, 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 methods: { 85 methods: {
76 async downloadFile() { 86 async downloadFile() {
77 if (this.downLoading) return; 87 if (this.downLoading) return;
78 this.downLoading = true; 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 this.downLoading = false; 103 this.downLoading = false;
81 console.log(data); 104 console.log(data);
82 if (data) { 105 if (data) {
@@ -138,18 +161,21 @@ export default { @@ -138,18 +161,21 @@ export default {
138 padding: 50px; 161 padding: 50px;
139 display: flex; 162 display: flex;
140 justify-content: center; 163 justify-content: center;
  164 +
141 .down-item { 165 .down-item {
142 width: 400px; 166 width: 400px;
143 - height:330px; 167 + height: 330px;
144 border-radius: 20px; 168 border-radius: 20px;
145 margin: 20px; 169 margin: 20px;
146 background: #f8f8f8; 170 background: #f8f8f8;
147 box-shadow: 2px 2px 5px #ccc; 171 box-shadow: 2px 2px 5px #ccc;
  172 +
148 .h-title { 173 .h-title {
149 font-size: 16px; 174 font-size: 16px;
150 color: #667ffd; 175 color: #667ffd;
151 padding: 16px 0 16px 12px; 176 padding: 16px 0 16px 12px;
152 } 177 }
  178 +
153 .txt { 179 .txt {
154 height: 80px; 180 height: 80px;
155 padding: 0 20px; 181 padding: 0 20px;
@@ -158,22 +184,35 @@ export default { @@ -158,22 +184,35 @@ export default {
158 line-height: 24px; 184 line-height: 24px;
159 text-align: center; 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 .upload-demo { 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 display: block; 201 display: block;
166 } 202 }
167 } 203 }
  204 +
168 :deep(.el-upload) { 205 :deep(.el-upload) {
169 margin: 0 auto; 206 margin: 0 auto;
170 } 207 }
  208 +
171 .btn-box { 209 .btn-box {
172 display: flex; 210 display: flex;
173 flex-direction: column; 211 flex-direction: column;
174 justify-content: center; 212 justify-content: center;
175 align-items: center; 213 align-items: center;
176 padding-bottom: 10px; 214 padding-bottom: 10px;
  215 +
177 .fa { 216 .fa {
178 font-size: 80px; 217 font-size: 80px;
179 color: #aeaeae; 218 color: #aeaeae;
@@ -181,6 +220,7 @@ export default { @@ -181,6 +220,7 @@ export default {
181 cursor: pointer; 220 cursor: pointer;
182 } 221 }
183 } 222 }
  223 +
184 .btn-box { 224 .btn-box {
185 width: 100%; 225 width: 100%;
186 } 226 }