From 796479c5f1daf13c46c8271855d7956a0d0ef883 Mon Sep 17 00:00:00 2001 From: paidaxing444 <12qwaszx> Date: Fri, 6 Nov 2020 15:42:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B9=BC=E5=84=BF=E8=AF=84=E4=BC=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/api/benyi/assessmentchild.js | 53 +++++++++++++ .../src/api/benyi/assessmentrecordchild.js | 53 +++++++++++++ .../src/views/benyi/assessment/student.vue | 75 +++++++++++++++++-- .../ByAssessmentchildController.java | 22 +++++- .../benyi/domain/ByAssessmentchild.java | 15 ++++ 5 files changed, 210 insertions(+), 8 deletions(-) create mode 100644 ruoyi-ui/src/api/benyi/assessmentchild.js create mode 100644 ruoyi-ui/src/api/benyi/assessmentrecordchild.js diff --git a/ruoyi-ui/src/api/benyi/assessmentchild.js b/ruoyi-ui/src/api/benyi/assessmentchild.js new file mode 100644 index 000000000..52868d190 --- /dev/null +++ b/ruoyi-ui/src/api/benyi/assessmentchild.js @@ -0,0 +1,53 @@ +import request from '@/utils/request' + +// 查询幼儿评估列表 +export function listAssessmentchild(query) { + return request({ + url: '/benyi/assessmentchild/list', + method: 'get', + params: query + }) +} + +// 查询幼儿评估详细 +export function getAssessmentchild(id) { + return request({ + url: '/benyi/assessmentchild/' + id, + method: 'get' + }) +} + +// 新增幼儿评估 +export function addAssessmentchild(data) { + return request({ + url: '/benyi/assessmentchild', + method: 'post', + data: data + }) +} + +// 修改幼儿评估 +export function updateAssessmentchild(data) { + return request({ + url: '/benyi/assessmentchild', + method: 'put', + data: data + }) +} + +// 删除幼儿评估 +export function delAssessmentchild(id) { + return request({ + url: '/benyi/assessmentchild/' + id, + method: 'delete' + }) +} + +// 导出幼儿评估 +export function exportAssessmentchild(query) { + return request({ + url: '/benyi/assessmentchild/export', + method: 'get', + params: query + }) +} \ No newline at end of file diff --git a/ruoyi-ui/src/api/benyi/assessmentrecordchild.js b/ruoyi-ui/src/api/benyi/assessmentrecordchild.js new file mode 100644 index 000000000..5f0d26c8a --- /dev/null +++ b/ruoyi-ui/src/api/benyi/assessmentrecordchild.js @@ -0,0 +1,53 @@ +import request from '@/utils/request' + +// 查询幼儿评估记录列表 +export function listAssessmentrecordchild(query) { + return request({ + url: '/benyi/assessmentrecordchild/list', + method: 'get', + params: query + }) +} + +// 查询幼儿评估记录详细 +export function getAssessmentrecordchild(id) { + return request({ + url: '/benyi/assessmentrecordchild/' + id, + method: 'get' + }) +} + +// 新增幼儿评估记录 +export function addAssessmentrecordchild(data) { + return request({ + url: '/benyi/assessmentrecordchild', + method: 'post', + data: data + }) +} + +// 修改幼儿评估记录 +export function updateAssessmentrecordchild(data) { + return request({ + url: '/benyi/assessmentrecordchild', + method: 'put', + data: data + }) +} + +// 删除幼儿评估记录 +export function delAssessmentrecordchild(id) { + return request({ + url: '/benyi/assessmentrecordchild/' + id, + method: 'delete' + }) +} + +// 导出幼儿评估记录 +export function exportAssessmentrecordchild(query) { + return request({ + url: '/benyi/assessmentrecordchild/export', + method: 'get', + params: query + }) +} \ No newline at end of file diff --git a/ruoyi-ui/src/views/benyi/assessment/student.vue b/ruoyi-ui/src/views/benyi/assessment/student.vue index ac813ac70..15d2e8888 100644 --- a/ruoyi-ui/src/views/benyi/assessment/student.vue +++ b/ruoyi-ui/src/views/benyi/assessment/student.vue @@ -13,6 +13,7 @@ icon="el-icon-s-data" size="mini" @click="submitForm" + v-hasPermi="['benyi:assessmentchild:add']" >生成图表 @@ -72,9 +73,14 @@ :key="itemYs.id" >

- {{ - itemYs.name - }} + + {{ + itemYs.name + }} +

{{ itemYs.ckbz }} @@ -156,15 +162,21 @@ import { } from "@/api/benyi/assessmentcontent"; import { getChildByAssessment } from "@/api/benyi/child"; +import { + addAssessmentchild, + updateAssessmentchild, +} from "@/api/benyi/assessmentchild"; export default { name: "Assessmentstudent", data() { return { + childId: "", childName: "", childCsrq: "", bjmc: "", + classid: "", trem: "", zbjsxm: "", assessmentscope: "", @@ -174,6 +186,8 @@ export default { ids: [], // 评估内容表格数据 assessmentcontentList: [], + // 表单参数 + form: {}, // 查询参数 queryParams: { parentid: undefined, @@ -184,23 +198,26 @@ export default { }, activeName: "健康", checked: false, + checkList: [], }; }, created() { // this.getList(); const childId = this.$route.params && this.$route.params.id; - console.log("childId:" + childId); + this.childId = childId; + // console.log("childId:" + childId); this.getChild(childId); }, methods: { getChild(childId) { getChildByAssessment(childId).then((response) => { - console.log(response); + // console.log(response); if (response.code == "200") { this.childName = response.data.name; this.childCsrq = response.data.csrq; this.trem = response.trem; this.bjmc = response.data.bjmc; + this.classid = response.data.classid; this.zbjsxm = response.data.zbjsmc; if (response.isAssessment == "0") { this.msgError( @@ -218,7 +235,7 @@ export default { getList() { this.loading = true; listAssessmentcontent(this.queryParams).then((response) => { - console.log("rows:" + response.rows); + // console.log("rows:" + response.rows); this.assessmentcontentList = response.rows; this.loading = false; }); @@ -233,11 +250,55 @@ export default { this.resetForm("queryForm"); this.handleQuery(); }, + // // 表单重置 + // reset() { + // this.form = { + // id: undefined, + // childid: undefined, + // classid: undefined, + // contentid: undefined, + // type: undefined, + // xn: undefined, + // userid: undefined, + // createTime: undefined, + // }; + // this.resetForm("form"); + // }, /** 提交按钮 */ - submitForm: function () {}, + submitForm: function () { + var items = ""; + this.checkList.forEach((item) => { + //当全选被选中的时候,循环遍历源数据,把数据的每一项加入到默认选中的数组去 + items = items + item + ","; + }); + // console.log(items); + // console.log("提交:"+this.checkList.length); + if (this.checkList.length == 0) { + this.msgError("请至少选择一项数据"); + } else { + this.form.childid = this.childId; + this.form.classid = this.classid; + this.form.items = items; + this.form.type = "Y"; + this.form.xn = this.trem; + addAssessmentchild(this.form).then((response) => { + if (response.code === 200) { + this.msgSuccess("评估成功"); + } + }); + } + }, handleClick(tab) { // this.activeName = tab }, + handlecheckedItemsChange(value) { + // var items = ""; + // this.checkList.forEach((item) => { + // //当全选被选中的时候,循环遍历源数据,把数据的每一项加入到默认选中的数组去 + // items = items + item + ","; + // }); + // console.log(items); + }, }, }; diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByAssessmentchildController.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByAssessmentchildController.java index 927b1fcdc..1d9af91bd 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByAssessmentchildController.java +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByAssessmentchildController.java @@ -2,6 +2,8 @@ package com.ruoyi.project.benyi.controller; import java.util.List; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.project.common.SchoolCommon; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -32,6 +34,8 @@ import com.ruoyi.framework.web.page.TableDataInfo; public class ByAssessmentchildController extends BaseController { @Autowired private IByAssessmentchildService byAssessmentchildService; + @Autowired + private SchoolCommon schoolCommon; /** * 查询幼儿评估列表 @@ -72,7 +76,23 @@ public class ByAssessmentchildController extends BaseController { @Log(title = "幼儿评估", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody ByAssessmentchild byAssessmentchild) { - return toAjax(byAssessmentchildService.insertByAssessmentchild(byAssessmentchild)); + int iCount = 0; + byAssessmentchild.setUserid(SecurityUtils.getLoginUser().getUser().getUserId()); + String strItems = byAssessmentchild.getItems(); + //System.out.println("执行嘛?"+strItems); + //判断选中的checkbox是否为空 + if (schoolCommon.isStringEmpty(strItems)) { + return AjaxResult.error("请至少选择一个评估项"); + } else { + String[] strArr = strItems.split(","); + for (int i = 0; i < strArr.length; i++) { + //System.out.println("contentid:"+strArr[i]); + byAssessmentchild.setContentid(Long.valueOf(strArr[i])); + iCount = byAssessmentchildService.insertByAssessmentchild(byAssessmentchild); + } + } + + return toAjax(iCount); } /** diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/domain/ByAssessmentchild.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/domain/ByAssessmentchild.java index e08b8290d..7bc2ce3bd 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/benyi/domain/ByAssessmentchild.java +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/domain/ByAssessmentchild.java @@ -55,6 +55,11 @@ public class ByAssessmentchild extends BaseEntity { @Excel(name = "创建人") private Long userid; + /** + * 临时创建用 + */ + private String items; + public void setId(Long id) { this.id = id; } @@ -111,6 +116,15 @@ public class ByAssessmentchild extends BaseEntity { return userid; } + public void setItems(String items) { + this.items = items; + } + + public String getItems() { + return items; + } + + @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) @@ -122,6 +136,7 @@ public class ByAssessmentchild extends BaseEntity { .append("xn", getXn()) .append("userid", getUserid()) .append("createTime", getCreateTime()) + .append("items", getItems()) .toString(); } } \ No newline at end of file