From c6206985701197e1c29c490644c69f6e37859eac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E8=BE=89?= <814457906@qq.com> Date: Fri, 30 Sep 2022 14:32:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/baseurl.js | 2 +- src/api/system/kindergartenCheckReport.js | 9 +- src/views/system/classconstitution/index.vue | 382 +++++++++--------- .../system/kindergartenCheckReport/index.vue | 25 +- .../system/personalCheckReport/index.vue | 2 +- 5 files changed, 219 insertions(+), 201 deletions(-) diff --git a/src/api/baseurl.js b/src/api/baseurl.js index 6ca908c..10f4072 100644 --- a/src/api/baseurl.js +++ b/src/api/baseurl.js @@ -1,3 +1,3 @@ -var baseurl = "http://192.168.16.81:8081"; +var baseurl = "http://192.168.16.62:8080"; export default baseurl \ No newline at end of file diff --git a/src/api/system/kindergartenCheckReport.js b/src/api/system/kindergartenCheckReport.js index 20a5f81..d49c610 100644 --- a/src/api/system/kindergartenCheckReport.js +++ b/src/api/system/kindergartenCheckReport.js @@ -29,11 +29,10 @@ export function updateKindergartenCheckReport(data) { }) } -// 幼儿园报告下载/预览 -export function report(id) { +// 幼儿园报告预览 +export function report(kindergartenId, batchCode) { return request({ - url: `/system/kindergartenCheckReport/download/report?id=${id}`, - method: 'POST', - responseType: 'blob' + url: `/system/checkReport/kindergarten/constitution?kindergartenId=${kindergartenId}&batchCode=${batchCode}`, + method: 'get' }) } \ No newline at end of file diff --git a/src/views/system/classconstitution/index.vue b/src/views/system/classconstitution/index.vue index 7fbcea3..a5ffb25 100644 --- a/src/views/system/classconstitution/index.vue +++ b/src/views/system/classconstitution/index.vue @@ -343,198 +343,212 @@ export default { if (res.code == 500) { this.itemshow2 = true; this.itemshow = false; - } else if (res.data == []) { - this.itemshow2 = true; - this.itemshow = false; } else if (!res.data) { this.itemshow2 = true; this.itemshow = false; } else { - this.listname = []; - this.totalAvgFraction = res.data.totalAvgFraction; - this.categoryTableNameList = res.data.categoryTableNameList; - this.categoryAgeFractionList = res.data.categoryAgeFractionList; - this.categoryScoreList = res.data.categoryScoreList; - var list = []; - this.categoryTableNameList.forEach((e) => { - e.childrenTableNameList.forEach((el) => { - list.push(el.categoryId); - }); - }); - let yname = []; - this.categoryScoreList.forEach((el) => { - yname.push(el.className); - var listname = list.map((e) => { - var num = 0; - var number = el.categoryScoreList.findIndex( - (o) => o.categoryId == e - ); - if (number != -1) { - num = el.categoryScoreList[number].categoryName; - } - return num; - }); - this.listname = listname; - - var list1 = list.map((e) => { - var num = 0; - var number = el.categoryScoreList.findIndex( - (o) => o.categoryId == e - ); - if (number != -1) { - num = el.categoryScoreList[number].avgScore; - } - return num; - }); - el.list = list1; - }); - console.log(this.categoryScoreList); - console.log(this.listname); - for (var i = 0; i < this.listname.length; i++) { - name = this.categoryScoreList[0].categoryScoreList[i].categoryName; - ydata = [ - this.categoryScoreList[0].list[i], - this.categoryScoreList[1].list[i], - this.categoryScoreList[2].list[i], - ]; - var obj = { - name: name, - type: "bar", - label: labelOption, - emphasis: { - focus: "series", - }, - data: ydata, - }; - console.log(ydata); - yseries.push(obj); - names.push(name); + if (res.data.totalAvgFraction) { + this.totalAvgFraction = res.data.totalAvgFraction; } - console.log(yseries); - - var myChart = echarts.init(document.getElementById("chart")); - - var option; - - const posList = [ - "left", - "right", - "top", - "bottom", - "inside", - "insideTop", - "insideLeft", - "insideRight", - "insideBottom", - "insideTopLeft", - "insideTopRight", - "insideBottomLeft", - "insideBottomRight", - ]; - app.configParameters = { - rotate: { - min: 0, - max: 90, - }, - align: { - options: { - left: "left", - center: "center", - right: "right", - }, - }, - verticalAlign: { - options: { - top: "top", - middle: "middle", - bottom: "bottom", - }, - }, - position: { - options: posList.reduce(function (map, pos) { - map[pos] = pos; - return map; - }, {}), - }, - distance: { - min: 0, - max: 100, - }, - }; - app.config = { - rotate: 0, - align: "center", - verticalAlign: "middle", - position: "top", - distance: 15, - onChange: function () { - const labelOption = { - rotate: app.config.rotate, - align: app.config.align, - verticalAlign: app.config.verticalAlign, - position: app.config.position, - distance: app.config.distance, - }; - myChart.setOption({ - series: [ - { - label: labelOption, - }, - { - label: labelOption, - }, - { - label: labelOption, - }, - { - label: labelOption, - }, - ], + if (res.data.categoryAgeFractionList) { + this.categoryAgeFractionList = res.data.categoryAgeFractionList; + } + var list = []; + if (res.data.categoryTableNameList && res.data.categoryScoreList) { + this.categoryTableNameList = res.data.categoryTableNameList; + this.categoryTableNameList.forEach((e) => { + e.childrenTableNameList.forEach((el) => { + list.push(el.categoryId); }); - }, - }; - const labelOption = { - show: true, - position: app.config.position, - distance: app.config.distance, - align: app.config.align, - verticalAlign: app.config.verticalAlign, - rotate: app.config.rotate, - formatter: "{c}", - fontSize: 16, - rich: { - name: {}, - }, - }; + }); + console.log(list); - option = { - tooltip: { - trigger: "axis", - axisPointer: { - type: "", - }, - }, - legend: { - data: names, - }, - xAxis: [ - { - type: "category", - axisTick: { show: false }, - data: yname, - }, - ], - yAxis: [ - { - type: "value", - }, - ], - series: yseries, - }; + this.categoryScoreList = res.data.categoryScoreList; + let yname = []; + console.log(this.categoryScoreList); + this.categoryScoreList.forEach((el) => { + yname.push(el.className); + var listname = list.map((e) => { + var num = 0; + var number = el.categoryScoreList.findIndex( + (o) => o.categoryId == e + ); + if (number != -1) { + num = el.categoryScoreList[number].categoryName; + } + return num; + }); + this.listname = listname; + console.log(list); + var list1 = list.map((e) => { + var num = 0; + var number = el.categoryScoreList.findIndex( + (o) => o.categoryId == e + ); + if (number != -1) { + num = el.categoryScoreList[number].avgScore; + } + if (num == null) { + num = 0; + return num; + } + console.log(num); + return num; + }); + el.list = list1; + }); + console.log(this.categoryScoreList); + console.log(this.listname); + for (var i = 0; i < this.listname.length; i++) { + name = + this.categoryScoreList[0].categoryScoreList[i].categoryName; + ydata = [ + this.categoryScoreList[0].list[i], + this.categoryScoreList[1].list[i], + this.categoryScoreList[2].list[i], + ]; + var obj = { + name: name, + type: "bar", + label: labelOption, + emphasis: { + focus: "series", + }, + data: ydata, + }; + console.log(ydata); + yseries.push(obj); + names.push(name); + } - option && myChart.setOption(option, true); - this.itemshow2 = false; - this.itemshow = true; + this.listname = []; + + console.log(yseries); + + var myChart = echarts.init(document.getElementById("chart")); + + var option; + + const posList = [ + "left", + "right", + "top", + "bottom", + "inside", + "insideTop", + "insideLeft", + "insideRight", + "insideBottom", + "insideTopLeft", + "insideTopRight", + "insideBottomLeft", + "insideBottomRight", + ]; + app.configParameters = { + rotate: { + min: 0, + max: 90, + }, + align: { + options: { + left: "left", + center: "center", + right: "right", + }, + }, + verticalAlign: { + options: { + top: "top", + middle: "middle", + bottom: "bottom", + }, + }, + position: { + options: posList.reduce(function (map, pos) { + map[pos] = pos; + return map; + }, {}), + }, + distance: { + min: 0, + max: 100, + }, + }; + app.config = { + rotate: 0, + align: "center", + verticalAlign: "middle", + position: "top", + distance: 15, + onChange: function () { + const labelOption = { + rotate: app.config.rotate, + align: app.config.align, + verticalAlign: app.config.verticalAlign, + position: app.config.position, + distance: app.config.distance, + }; + myChart.setOption({ + series: [ + { + label: labelOption, + }, + { + label: labelOption, + }, + { + label: labelOption, + }, + { + label: labelOption, + }, + ], + }); + }, + }; + const labelOption = { + show: true, + position: app.config.position, + distance: app.config.distance, + align: app.config.align, + verticalAlign: app.config.verticalAlign, + rotate: app.config.rotate, + formatter: "{c}", + fontSize: 16, + rich: { + name: {}, + }, + }; + + option = { + tooltip: { + trigger: "axis", + axisPointer: { + type: "", + }, + }, + legend: { + data: names, + }, + xAxis: [ + { + type: "category", + axisTick: { show: false }, + data: yname, + }, + ], + yAxis: [ + { + type: "value", + }, + ], + series: yseries, + }; + + option && myChart.setOption(option, true); + this.itemshow2 = false; + this.itemshow = true; + } } }); }, diff --git a/src/views/system/kindergartenCheckReport/index.vue b/src/views/system/kindergartenCheckReport/index.vue index f37e073..c504a87 100644 --- a/src/views/system/kindergartenCheckReport/index.vue +++ b/src/views/system/kindergartenCheckReport/index.vue @@ -616,19 +616,22 @@ export default { this.reset(); const id = row.id || this.ids; this.form = row; + var code = ""; existKindergartenCheckReport(row.kindergartenId, row.batchCode).then( (response) => { - console.log(this.form); - if (response.code == 200) { + console.log(response); + code = response.code; + if (response.data.existFlag) { this.title = "修改幼儿园检测报告审批状态"; this.pdfurl = baseurl + response.data.downloadAddress; this.open = true; - } else if (response.code == 500) { - report(row.id).then((res) => { + } else { + report(row.kindergartenId, row.batchCode).then((res) => { this.pdfurl = baseurl + res.data.downloadAddress; this.form.id = res.data.id; // this.pdfurl = window.URL.createObjectURL(res); // window.open(this.pdfurl); + console.log(this.form) this.open = true; }); } @@ -639,7 +642,11 @@ export default { submitForm() { console.log(this.form); if (this.form.id != null) { - updateKindergartenCheckReport(this.form).then((response) => { + var obj = { + id: this.form.id, + checkStatus: this.form.checkStatus, + }; + updateKindergartenCheckReport(obj).then((response) => { this.$modal.msgSuccess("修改成功"); this.open = false; this.queryParams = { @@ -654,8 +661,9 @@ export default { }, //预览 lookhand(item) { - report(item.id).then((res) => { - this.pdfurl = window.URL.createObjectURL(res); + report(item.kindergartenId, item.batchCode).then((res) => { + // this.pdfurl = window.URL.createObjectURL(res); + this.pdfurl = baseurl + res.data.downloadAddress; this.openiframe = true; console.log(this.pdfurl); // window.open(this.pdfurl); @@ -676,9 +684,6 @@ export default { ); } }, - kinbatlist(kindergartenId, batchCode) { - console.log(kindergartenId, batchCode); - }, //幼儿园左侧点击 kindergartenNameclick(row) { diff --git a/src/views/system/personalCheckReport/index.vue b/src/views/system/personalCheckReport/index.vue index a0534f1..307c345 100644 --- a/src/views/system/personalCheckReport/index.vue +++ b/src/views/system/personalCheckReport/index.vue @@ -884,7 +884,7 @@ export default { // this.form = row; this.title = "修改个人体质检测报告"; existCheckReport(row.studentId, row.batchCode).then((res) => { - if (res.code == 200) { + if (res.data.existFlag) { this.pdfurl = baseurl + res.data.downloadAddress; this.open = true; } else {