Commit a4074db88677f07c0c8a33562f006cd0a2e185e1

Authored by 梁保满
1 parent 3a9aa32b

使用分析,集团管理元交互

src/components/charts/barChart.vue
... ... @@ -116,6 +116,9 @@ export default {
116 116 this.chart?.clear();
117 117 this.chart.setOption(options, true);
118 118 },
  119 + clearChart(){
  120 + this.chart?.clear();
  121 + },
119 122 },
120 123 };
121 124 </script>
... ...
src/views/standard/analysis/index.vue
... ... @@ -4,10 +4,22 @@
4 4 <template slot="title">
5 5 <span>使用分析</span>
6 6 </template>
  7 + <template slot="btns">
  8 + <el-tooltip effect="dark" content="导出报表" placement="bottom">
  9 + <el-button
  10 + type="primary"
  11 + icon="fa fa-cloud-download"
  12 + size="mini"
  13 + plain
  14 + circle
  15 + @click="downExc"
  16 + ></el-button>
  17 + </el-tooltip>
  18 + </template>
7 19 </back-box>
8 20 <div class="page-content">
9 21 <ul class="params-box">
10   - <li class="item">
  22 + <li class="item item3">
11 23 <span class="s-txt">时间段:</span>
12 24 <div class="sel-box">
13 25 <div class="d1">
... ... @@ -54,6 +66,15 @@
54 66 >
55 67 </p>
56 68 </div>
  69 + <el-button
  70 + class="btn"
  71 + v-if="role == 'ROLE_JITUAN'"
  72 + type="primary"
  73 + round
  74 + size="small"
  75 + @click="resetRank"
  76 + >使用频率排名</el-button
  77 + >
57 78 </li>
58 79 <li class="item item2" v-for="(item, index) in query.secGraClaSub">
59 80 <span class="s-txt">对比项{{ setBigNum(index) }}:</span>
... ... @@ -76,16 +97,22 @@
76 97 <span class="s-txt"></span>
77 98 <div class="disflex-b">
78 99 <el-button
79   - v-show="query.secGraClaSub.length < 10"
80   - class="btn"
  100 + class="btn btn-none"
  101 + :class="query.secGraClaSub.length < 10 ? '' : 'active'"
81 102 icon="el-icon-plus"
82 103 size="small"
83 104 round
84 105 @click="addQuery"
85 106 >添加对比项</el-button
86 107 >
87   - <el-button class="btn" round size="small" @click="getData"
88   - >确定</el-button
  108 + <el-button
  109 + v-show="query.secGraClaSub.length"
  110 + class="btn"
  111 + type="primary"
  112 + round
  113 + size="small"
  114 + @click="getData"
  115 + >多项对比</el-button
89 116 >
90 117 </div>
91 118 </li>
... ... @@ -99,7 +126,7 @@
99 126  
100 127 <script>
101 128 import barChart from "@/components/charts/barChart";
102   -import { formatDate } from "@/utils";
  129 +import { formatDate, downloadFile } from "@/utils";
103 130 export default {
104 131 components: {
105 132 barChart,
... ... @@ -180,10 +207,35 @@ export default {
180 207 this.query.startDay = formatDate(new Date(), "yyyy-MM-dd");
181 208 this.query.endDay = formatDate(new Date(), "yyyy-MM-dd");
182 209 }
183   - this.setDate(4);
  210 + this.setDate(3);
184 211 this._QueryData();
185 212 },
186 213 methods: {
  214 + async downExc() {
  215 + if (this.exportLoading == true) return;
  216 + let query = {
  217 + //搜索条件
  218 + startDay: this.query.startDay,
  219 + endDay: this.query.endDay,
  220 + day: this.query.day,
  221 + };
  222 + this.exportLoading = true;
  223 +
  224 + const exportUsageAnalysis =
  225 + this.role != "ROLE_JITUAN"
  226 + ? this.$request.exportUsageAnalysis
  227 + : this.$request.exportSchoolContrast;
  228 + const data = await exportUsageAnalysis({ ...query });
  229 + this.exportLoading = false;
  230 + if (data) {
  231 + let blob = new Blob([data], {
  232 + type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
  233 + });
  234 + downloadFile("使用分析.xlsx", blob);
  235 + } else {
  236 + this.$message.error("下载失败");
  237 + }
  238 + },
187 239 addQuery() {
188 240 this.query.secGraClaSub.push([]);
189 241 this.query.secGraClaSubName.push("");
... ... @@ -194,7 +246,7 @@ export default {
194 246 })[0];
195 247 },
196 248 secGraClaSubChange(event, index) {
197   - console.log(event)
  249 + console.log(event);
198 250 let txt = "";
199 251 let xx = this.filterObj(this.gradeList, event[0]);
200 252 txt += xx.label;
... ... @@ -345,6 +397,17 @@ export default {
345 397 }
346 398 return query;
347 399 },
  400 + async resetRank() {
  401 + this.query.secGraClaSub = [];
  402 + this.query.secGraClaSubName = [];
  403 + this.chartData[0].value = [];
  404 + this.chartData[1].value = [];
  405 + this.xAxis = [];
  406 + this.$refs.barChart.clearChart();
  407 + await this._QuerySchool();
  408 + await this._QueryGradeList();
  409 + this._QueryData();
  410 + },
348 411 async _QueryData() {
349 412 this.loading = true;
350 413 let query = this.setQuery();
... ... @@ -359,9 +422,9 @@ export default {
359 422 if (status === 0) {
360 423 this.chartData[0].value = [];
361 424 this.chartData[1].value = [];
362   - this.xAxis = this.query.secGraClaSubName.map(item=>{
363   - let arr = item.split('/')
364   - return arr[0]+'\n'+ arr.slice(1,arr.length).join('/')
  425 + this.xAxis = this.query.secGraClaSubName.map((item) => {
  426 + let arr = item.split("/");
  427 + return arr[0] + "\n" + arr.slice(1, arr.length).join("/");
365 428 });
366 429 data?.list.map((item, index) => {
367 430 this.chartData[0].value.push(item.periodCount);
... ... @@ -482,7 +545,12 @@ export default {
482 545 },
483 546 async _QuerySchool() {
484 547 this.loading = true;
485   - const { data, status, info } = await this.$request.schoolList();
  548 + const { data, status, info } = await this.$request.schoolList({
  549 + needSort: 1,
  550 + day: this.query.day,
  551 + startDay: this.query.startDay,
  552 + endDay: this.query.endDay,
  553 + });
486 554 this.loading = false;
487 555 if (status === 0) {
488 556 this.schoolList = [...data.list] || [];
... ... @@ -511,11 +579,26 @@ div::-webkit-scrollbar-thumb {
511 579 display: flex;
512 580 justify-content: space-between;
513 581 align-items: center;
  582 + .btn-none {
  583 + border: none;
  584 + background: none;
  585 + }
  586 + .active {
  587 + transform: translateX(-999999px);
  588 + }
  589 +}
  590 +.item3 {
  591 + .sel-box {
  592 + flex: 1;
  593 + }
514 594 }
515 595 .sel-box {
516 596 display: flex;
517 597 align-items: center;
518 598 flex-wrap: nowrap;
  599 + .btn {
  600 + margin-left: 100px;
  601 + }
519 602 .sel {
520 603 width: 8%;
521 604 min-width: 160px;
... ... @@ -591,6 +674,9 @@ div::-webkit-scrollbar-thumb {
591 674 .item2 {
592 675 width: 50%;
593 676 }
  677 + .item3 {
  678 + padding-right: 100px;
  679 + }
594 680 }
595 681 .chart-box {
596 682 height: 400px;
... ...
src/views/standard/setUp/conglomerate.vue
... ... @@ -86,7 +86,8 @@
86 86 </div>
87 87 </div>
88 88 </div>
89   - <el-dialog :close-on-click-modal="false"
  89 + <el-dialog
  90 + :close-on-click-modal="false"
90 91 :title="isAdd ? '添加区域/集团' : '修改区域/集团'"
91 92 :visible.sync="diaCL"
92 93 width="400"
... ... @@ -113,7 +114,12 @@
113 114 <el-button round @click="diaCL = false">取 消</el-button>
114 115 </div>
115 116 </el-dialog>
116   - <el-dialog :close-on-click-modal="false" title="添加管理员" :visible.sync="diaAdmin" width="400">
  117 + <el-dialog
  118 + :close-on-click-modal="false"
  119 + title="添加管理员"
  120 + :visible.sync="diaAdmin"
  121 + width="400"
  122 + >
117 123 <el-form
118 124 class="form-box"
119 125 ref="formAdmin"
... ... @@ -158,7 +164,12 @@
158 164 <el-button round @click="diaAdmin = false">取 消</el-button>
159 165 </div>
160 166 </el-dialog>
161   - <el-dialog :close-on-click-modal="false" title="添加学校" :visible.sync="diaSchool" width="400">
  167 + <el-dialog
  168 + :close-on-click-modal="false"
  169 + title="添加学校"
  170 + :visible.sync="diaSchool"
  171 + width="400"
  172 + >
162 173 <el-form
163 174 class="form-box"
164 175 ref="formSchool"
... ... @@ -208,7 +219,12 @@
208 219 <el-button round @click="diaSchool = false">取 消</el-button>
209 220 </div>
210 221 </el-dialog>
211   - <el-dialog :close-on-click-modal="false" title="学校信息修改" :visible.sync="diaSchool2" width="400">
  222 + <el-dialog
  223 + :close-on-click-modal="false"
  224 + title="学校信息修改"
  225 + :visible.sync="diaSchool2"
  226 + width="400"
  227 + >
212 228 <el-form
213 229 class="form-box"
214 230 ref="formSchool2"
... ... @@ -470,6 +486,7 @@ export default {
470 486 this.loading = true;
471 487 const { data, status, info } = await this.$request.schoolList({
472 488 regionId: this.showId,
  489 + needCount: 1,
473 490 });
474 491 this.loading = false;
475 492 if (status === 0) {
... ...
src/views/standard/setUp/teacher.vue
... ... @@ -45,6 +45,7 @@
45 45 class="sel sel2"
46 46 clearable
47 47 placeholder="选择范围"
  48 + @change="_QueryData(1)"
48 49 v-model="query.gradeClassSub"
49 50 :options="gradeClassSubList"
50 51 :props="{
... ... @@ -93,9 +94,9 @@
93 94 @click="_QueryData(3)"
94 95 ></el-button>
95 96 </el-input>
96   - <el-button class="serach-box" round @click="_QueryData(1)"
  97 + <!-- <el-button class="serach-box" round @click="_QueryData(4)"
97 98 >筛选</el-button
98   - >
  99 + > -->
99 100 </div>
100 101 </div>
101 102 <p class="total" v-if="teacherList.length">
... ...