Commit 1b9bae95933d739ae3eb46228383f6cd442bce3f

Authored by 梁保满
1 parent b21d90ef

级联选择器调整,日志接口调整

src/api/apis/apis.js
... ... @@ -186,6 +186,22 @@ export default {
186 186 data,
187 187 });
188 188 },
  189 + // 查询设备详情
  190 + deviceDetail(data) {
  191 + return service({
  192 + url: setUpUrls.deviceDetail,
  193 + method: "POST",
  194 + data,
  195 + });
  196 + },
  197 + // 分页查询设备日志列表
  198 + deviceLogList(data) {
  199 + return service({
  200 + url: setUpUrls.deviceLogList,
  201 + method: "POST",
  202 + data,
  203 + });
  204 + },
189 205 // 修改设备自动升级状态
190 206 modifyUpgradeFlag(data) {
191 207 return service({
... ...
src/api/urls/apis.js
... ... @@ -46,6 +46,10 @@ export default {
46 46 keyboardReport: "/api_html/school/manager/keyboardReport",
47 47 // 分页查询设备列表
48 48 deviceList: "/api_html/school/manager/deviceList",
  49 + // 查询设备详情
  50 + deviceDetail: "/api_html/school/manager/deviceDetail",
  51 + // 分页查询设备日志列表
  52 + deviceLogList: "/api_html/school/manager/deviceLogList",
49 53 // 修改设备自动升级状态
50 54 modifyUpgradeFlag: "/api_html/school/manager/modifyUpgradeFlag",
51 55 // 修改基站信息
... ...
src/main.js
... ... @@ -28,6 +28,13 @@ Vue.use(permission)
28 28 NProgress.inc(0.2)
29 29 NProgress.configure({ easing: "ease", speed: 500, showSpinner: false })
30 30  
  31 +
  32 +Array.prototype.remove = function (val) {
  33 + var index = this.indexOf(val);
  34 + if (index > -1) {
  35 + this.splice(index, 1);
  36 + }
  37 +};
31 38 /* eslint-disable no-new */
32 39 new Vue({
33 40 el: "#app",
... ...
src/views/analysis/index.vue
... ... @@ -10,8 +10,8 @@
10 10 <div class="sel-box">
11 11 <el-select
12 12 class="sel"
13   - v-model="query.gradeName"
14   - placeholder="选择年级"
  13 + v-model="query.regionId"
  14 + placeholder="选择区域"
15 15 @change="_QueryData"
16 16 >
17 17 <el-option
... ... @@ -71,22 +71,22 @@
71 71 style="width: 100%"
72 72 show-summary
73 73 >
74   - <el-table-column align="center" label="科目" prop="sub">
  74 + <el-table-column align="center" label="科目" prop="subjectName">
75 75 </el-table-column>
76 76 <el-table-column
77 77 align="center"
78 78 v-for="(item, index) in dataList"
79 79 :key="index"
80   - :label="item.name"
  80 + :label="item.schoolName"
81 81 >
82 82 <template>
83 83 <el-table-column
84   - :prop="'keshi' + index"
  84 + :prop="'periodCount' + index"
85 85 label="课时数"
86 86 align="center"
87 87 ></el-table-column>
88 88 <el-table-column
89   - :prop="'celian' + index"
  89 + :prop="'examCount' + index"
90 90 label="测练数"
91 91 align="center"
92 92 ></el-table-column>
... ... @@ -113,41 +113,14 @@ export default {
113 113 type: 1, //集团管理员 表格切换
114 114 query: {
115 115 //搜索条件
116   - gradeName: "",
  116 + regionId: "",
117 117 startDay: "",
118 118 endDay: "",
119 119 day: "",
120 120 },
121 121 gradeList: [],
122   - tableData: [
123   - {
124   - sub: "科目一",
125   - keshi0: 1,
126   - celian0: 1,
127   - keshi1: 2,
128   - celian1: 2,
129   - },
130   - {
131   - sub: "科目一",
132   - keshi0: 3,
133   - celian0: 4,
134   - keshi1: 5,
135   - celian1: 6,
136   - },
137   - ],
138   - dataList: [
139   - //table循环用数据
140   - {
141   - name: "初一",
142   - keshi: 1,
143   - celian: 1,
144   - },
145   - {
146   - name: "初二",
147   - keshi: 2,
148   - celian: 2,
149   - },
150   - ],
  122 + tableData: [],
  123 + dataList: [],
151 124 };
152 125 },
153 126 created() {
... ... @@ -155,7 +128,7 @@ export default {
155 128 (item) => item.roleName == this.$store.getters.info.showRoleName
156 129 )?.role;
157 130 this._QueryGradeList();
158   - // this.setDate(1);
  131 + this.setDate(1);
159 132 let startDay = this.query?.startDay;
160 133 if (!startDay) {
161 134 this.query.startDay = new Date();
... ... @@ -164,10 +137,10 @@ export default {
164 137 },
165 138 methods: {
166 139 changeType(val) {
167   - if(val==1){
168   - this.query.gradeName = ""
  140 + if (val == 1) {
  141 + this.query.regionId = "";
169 142 }
170   - this._QueryData(val)
  143 + this._QueryData(val);
171 144 },
172 145 setDate(index) {
173 146 const that = this;
... ... @@ -247,7 +220,7 @@ export default {
247 220 }
248 221 }
249 222 if (this.role == "ROLE_JITUAN") {
250   - if (this.query.gradeName == "") {
  223 + if (this.query.regionId == "") {
251 224 this.type = 1;
252 225 } else {
253 226 this.type = 2;
... ... @@ -264,7 +237,18 @@ export default {
264 237 });
265 238 this.loading = false;
266 239 if (status === 0) {
267   - this.tableData = [...data.list] || [];
  240 + this.tableData = data.map((item)=>{
  241 + let params={}
  242 + item.dataList.map((items,index)=>{
  243 + params['examCount'+index] = items.examCount
  244 + params['periodCount'+index] = items.periodCount
  245 + })
  246 + return {
  247 + subjectName:item.subjectName,
  248 + ...params,
  249 + }
  250 + });
  251 + this.dataList = data[0]?.dataList
268 252 } else {
269 253 this.$message.error(info);
270 254 }
... ...
src/views/device/index.vue
... ... @@ -90,10 +90,7 @@
90 90 @click="_QueryData(true)"
91 91 ></el-button>
92 92 </el-input>
93   - <el-button
94   - class="serach-box"
95   - round
96   - @click="_QueryData(true)"
  93 + <el-button class="serach-box" round @click="_QueryData(true)"
97 94 >筛选</el-button
98 95 >
99 96 </div>
... ... @@ -225,12 +222,9 @@
225 222 @click="_QueryData(true)"
226 223 ></el-button>
227 224 </el-input>
228   - <el-button
229   - class="serach-box"
230   - round
231   - @click="_QueryData(true)"
  225 + <el-button class="serach-box" round @click="_QueryData(true)"
232 226 >筛选</el-button
233   - >ƒ
  227 + >
234 228 </div>
235 229 </div>
236 230 <el-table :data="tableData" border style="width: 100%">
... ... @@ -505,7 +499,7 @@ export default {
505 499 diaAnswerEqu: false,
506 500 gradeList: [],
507 501 gradeListAll: [],
508   - props: { multiple: true, checkStrictly: false },
  502 + props: { multiple: true, checkStrictly: true },
509 503 type: 1,
510 504 query: {
511 505 classId: [],
... ... @@ -693,20 +687,19 @@ export default {
693 687 ? this.$request.gradeList
694 688 : this.$request.regionList;
695 689 const { data, status, info } = await gradeList();
696   - console.log(status);
697 690 if (status === 0) {
698 691 if (!!data.list) {
699 692 if (this.role != "ROLE_JITUAN") {
700 693 this.gradeList =
701 694 data.list?.map((item) => {
702 695 let gradeList = {
703   - value: item.grade,
  696 + value: item.gradeName,
704 697 label: item.gradeName,
705 698 };
706 699 gradeList.children =
707 700 item.classList?.map((items) => {
708 701 return {
709   - value: items.classCode,
  702 + value: Number(items.classCode),
710 703 label: items.className,
711 704 };
712 705 }) || [];
... ... @@ -792,23 +785,11 @@ export default {
792 785 this.$message.error(info);
793 786 }
794 787 },
795   - // 设备列表信息
796   - async _QueryData(isRef) {
797   - this.loading = true;
798   - let query = {};
799   - let gradeNames = [];
800   - let classIds = [];
801   - this.query.classId.map((item) => {
802   - if (!gradeNames.includes(item[0])) {
803   - gradeNames.push(item[0]);
804   - }
805   - classIds.push(item[1]);
806   - });
  788 + setQuery(){//整理传参
  789 + let query = {}
807 790 if (this.query.sn) {
808 791 query.sn = this.query.sn;
809 792 } else {
810   - gradeNames.length ? (query.gradeNames = gradeNames) : "";
811   - classIds.length ? (query.classIds = classIds) : "";
812 793 if (this.type == 1) {
813 794 this.query.onlineStatus !== ""
814 795 ? (query.onlineStatus = this.query.onlineStatus)
... ... @@ -816,9 +797,51 @@ export default {
816 797 } else if (this.type == 2) {
817 798 this.query.type !== "" ? (query.type = this.query.type) : "";
818 799 }
  800 + if (this.role == "ROLE_JITUAN") {
  801 + query.regionIds = [];
  802 + query.schoolIds = [];
  803 + this.query.classId?.map((item) => {
  804 + if (item.length == 1) {
  805 + if(!query.regionIds.includes(item[0])){
  806 + query.regionIds.push(item[0]);
  807 + }
  808 + } else {
  809 + if (!query.schoolIds.includes(item[1])) {
  810 + query.schoolIds.push(item[1]);
  811 + }
  812 + if (query.regionIds.includes(item[0])) {
  813 + query.regionIds.remove(item[0]);
  814 + }
  815 + }
  816 + });
  817 + } else {
  818 + query.gradeNames = [];
  819 + query.classIds = [];
  820 + this.query.classId?.map((item) => {
  821 + if (item.length == 1) {
  822 + if(!query.gradeNames.includes(item[0])){
  823 + query.gradeNames.push(item[0]);
  824 + }
  825 + } else {
  826 + if (!query.classIds.includes(item[1])) {
  827 + query.classIds.push(item[1]);
  828 + }
  829 + if (query.gradeNames.includes(item[0])) {
  830 + query.gradeNames.remove(item[0]);
  831 + }
  832 + }
  833 + });
  834 + }
  835 + delete query.classId;
819 836 }
820   - if(isRef){
821   - this.page= 1
  837 + return query
  838 + },
  839 + // 设备列表信息
  840 + async _QueryData(isRef) {
  841 + this.loading = true;
  842 + let query = this.setQuery()
  843 + if (isRef) {
  844 + this.page = 1;
822 845 }
823 846 this.loading = true;
824 847 const deviceList =
... ...
src/views/device/log.vue
... ... @@ -7,20 +7,26 @@
7 7 </back-box>
8 8 <div class="page-content">
9 9 <el-descriptions :column="3" border>
10   - <el-descriptions-item label="设备编码"
11   - >kooriookami</el-descriptions-item
12   - >
13   - <el-descriptions-item label="电量">18100000000</el-descriptions-item>
14   - <el-descriptions-item label="配对码">苏州市</el-descriptions-item>
15   - <el-descriptions-item label="关联班级"
16   - >江苏省苏州市吴中区</el-descriptions-item
17   - >
18   - <el-descriptions-item label="最后答题时间"
19   - >江苏省苏州市吴中区</el-descriptions-item
20   - >
21   - <el-descriptions-item label="答题次数"
22   - >江苏省苏州市吴中区</el-descriptions-item
23   - >
  10 + <el-descriptions-item label="设备编码">{{
  11 + device.sn
  12 + }}</el-descriptions-item>
  13 + <el-descriptions-item label="电量">{{
  14 + device.electricity
  15 + }}</el-descriptions-item>
  16 + <el-descriptions-item label="配对码">{{
  17 + device.pairingCode
  18 + }}</el-descriptions-item>
  19 + <el-descriptions-item label="关联班级">
  20 + <span v-for="item in device.classList" :key="item.classId">{{
  21 + item.className
  22 + }}</span>
  23 + </el-descriptions-item>
  24 + <el-descriptions-item label="最后答题时间">{{
  25 + device.latestReportTime
  26 + }}</el-descriptions-item>
  27 + <el-descriptions-item label="答题次数">{{
  28 + device.answerTimes
  29 + }}</el-descriptions-item>
24 30 </el-descriptions>
25 31 </div>
26 32 <div class="answer-header">
... ... @@ -60,6 +66,42 @@
60 66 </p>
61 67 </div>
62 68 </div>
  69 + <div class="table-box">
  70 + <el-table :data="tableData" border style="width: 100%">
  71 + <el-table-column
  72 + prop="operationType"
  73 + label="请求类型"
  74 + align="center"
  75 + width="200"
  76 + ><template slot-scope="scoped">{{
  77 + setOperationType(scoped.row.operationType)
  78 + }}</template></el-table-column
  79 + >
  80 + <el-table-column
  81 + prop="operationTime"
  82 + label="时间"
  83 + align="center"
  84 + width="200"
  85 + ></el-table-column>
  86 + <el-table-column
  87 + prop="content"
  88 + label="日志内容"
  89 + align="center"
  90 + ></el-table-column>
  91 + </el-table>
  92 + </div>
  93 + <div class="pagination-box">
  94 + <el-pagination
  95 + small=""
  96 + layout="total,prev, pager, next"
  97 + :hide-on-single-page="true"
  98 + :total="total"
  99 + @current-change="changePage"
  100 + :current-page="page"
  101 + :page-size="size"
  102 + >
  103 + </el-pagination>
  104 + </div>
63 105 </div>
64 106 </template>
65 107  
... ... @@ -68,7 +110,7 @@ import { formatDate } from &quot;utils&quot;;
68 110 export default {
69 111 data() {
70 112 return {
71   - id:'',
  113 + id: "",
72 114 date: "", //今天-昨天-本周
73 115 query: {
74 116 //搜索条件
... ... @@ -76,11 +118,24 @@ export default {
76 118 endDay: "",
77 119 day: "",
78 120 },
  121 + tableData: [],
  122 + device: {
  123 + sn: "",
  124 + electricity: "",
  125 + pairingCode: "",
  126 + classList: [],
  127 + latestReportTime: "",
  128 + answerTimes: "",
  129 + },
  130 + total: 0,
  131 + page: 1,
  132 + size: 20,
79 133 };
80 134 },
81 135 created() {
82   - this.id = this.$route.query.id
83   - // await this.setDate(1);
  136 + this.id = this.$route.query.id;
  137 + this._QueryDetail();
  138 + this.setDate(1);
84 139 let startDay = this.query?.startDay;
85 140 if (!startDay) {
86 141 this.query.startDay = new Date();
... ... @@ -88,6 +143,36 @@ export default {
88 143 }
89 144 },
90 145 methods: {
  146 + setOperationType(type) {
  147 + let txt;
  148 + switch (type) {
  149 + case 0:
  150 + txt = "连接异常";
  151 + break;
  152 + case 1:
  153 + txt = "问";
  154 + break;
  155 + case 2:
  156 + txt = "测";
  157 + break;
  158 + case 3:
  159 + txt = "考";
  160 + break;
  161 + case 4:
  162 + txt = "抢答";
  163 + break;
  164 + case 5:
  165 + txt = "抽答";
  166 + break;
  167 + case 6:
  168 + txt = "再答";
  169 + break;
  170 + case 7:
  171 + txt = "签到";
  172 + break;
  173 + }
  174 + return txt;
  175 + },
91 176 setDate(index) {
92 177 const that = this;
93 178 this.date = index == this.date ? "" : index;
... ... @@ -156,21 +241,50 @@ export default {
156 241 }
157 242 }
158 243 },
  244 + changePage(page) {
  245 + this.page = page;
  246 + this._QueryData();
  247 + },
  248 + async _QueryDetail() {
  249 + const { data, status, info } = await this.$request.deviceDetail({
  250 + deviceId: this.id,
  251 + });
  252 + if (status === 0) {
  253 + this.device = { ...data };
  254 + for (let key in this.device) {
  255 + this.device[key] = data[key];
  256 + }
  257 + } else {
  258 + this.$message.error(info);
  259 + }
  260 + },
159 261 async _QueryData() {
160 262 this.loading = true;
161 263 //多课时对比
162 264 let query = {};
163 265 for (let key in this.query) {
164 266 if (this.query[key] != "") {
165   - query[key] = this.query[key];
  267 + if (key == "day" || key == "startDay" || key == "endDay") {
  268 + query[key] = this.query[key].split("-").join("");
  269 + } else {
  270 + query[key] = this.query[key];
  271 + }
166 272 }
167 273 }
168   - const { data, status, info } = await this.$request.fetchQuizList({
  274 + const {
  275 + data = {},
  276 + status,
  277 + info,
  278 + } = await this.$request.deviceLogList({
169 279 ...query,
170   - id:this.id
  280 + deviceId: Number(this.id),
  281 + page: this.page,
  282 + size: this.size,
171 283 });
172 284 this.loading = false;
173 285 if (status === 0) {
  286 + this.tableData = [...data?.list] || [];
  287 + this.total = data.count;
174 288 } else {
175 289 this.$message.error(info);
176 290 }
... ... @@ -183,4 +297,7 @@ export default {
183 297 .page-content {
184 298 padding: 20px;
185 299 }
  300 +.table-box{
  301 + padding:0 20px;
  302 +}
186 303 </style>
187 304 \ No newline at end of file
... ...
src/views/login/index.vue
... ... @@ -91,14 +91,14 @@ export default {
91 91 disableClick: true,
92 92 passwordType: "password",
93 93 loginForm: {
94   - username: "13610050254",
95   - password: "Pw050254#",
  94 + // username: "13610050254",
  95 + // password: "Pw050254#",
96 96 // username: "18946034886",
97 97 // password: "Pw034886#",
98 98 // username: "18332123505",
99 99 // password: "Pw123505#",
100   - // username: "15911715665",
101   - // password: "Csiy88888",
  100 + username: "15911715665",
  101 + password: "Csiy88888",
102 102 },
103 103 loginRules: {
104 104 username: [
... ...
src/views/setUp/account.vue
... ... @@ -337,7 +337,7 @@ export default {
337 337 tenantRoleList: [],
338 338 regionList: [],
339 339 schoolList: [],
340   - props: { multiple: true, checkStrictly: false },
  340 + props: { multiple: true, checkStrictly: true },
341 341 roleList: [],
342 342 query: {
343 343 schoolId: [],
... ... @@ -553,7 +553,7 @@ export default {
553 553 this.$message.error(info);
554 554 }
555 555 },
556   - async _QueryData(type) {
  556 + setQuery(type) {//整理请求参数
557 557 let query = {};
558 558 if (type == 1) {
559 559 query.roleId = this.query.roleId;
... ... @@ -579,15 +579,25 @@ export default {
579 579 query.regionIds = [];
580 580 query.schoolIds = [];
581 581 query.schoolId?.map((item) => {
582   - if (!query.regionIds.includes(item[0])) {
583   - query.regionIds.push(item[0]);
584   - }
585   - if (!query.schoolIds.includes(item[1])) {
586   - query.schoolIds.push(item[1]);
  582 + if (item.length == 1) {
  583 + if (!query.regionIds.includes(item[0])) {
  584 + query.regionIds.push(item[0]);
  585 + }
  586 + } else {
  587 + if (!query.schoolIds.includes(item[1])) {
  588 + query.schoolIds.push(item[1]);
  589 + }
  590 + if (query.regionIds.includes(item[0])) {
  591 + query.regionIds.remove(item[0]);
  592 + }
587 593 }
588 594 });
589 595 delete query.schoolId;
590 596 }
  597 + return query;
  598 + },
  599 + async _QueryData(type) {
  600 + let query = this.setQuery(type);
591 601 this.loading = true;
592 602 this.tableData = [];
593 603 const { data, status, info } =
... ...