From 97f47e8942d16ff8bb055cebbe4f079428833618 Mon Sep 17 00:00:00 2001 From: paidaxing444 <12qwaszx> Date: Tue, 21 Jul 2020 18:00:49 +0800 Subject: [PATCH] =?UTF-8?q?20200721-zlp-1=20=E5=B9=BC=E5=84=BF=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/api/benyi/child.js | 9 + ruoyi-ui/src/views/benyi/child/index.vue | 656 +++++++++++++----- .../benyi/controller/ByChildController.java | 36 +- .../benyi/controller/ByThemeController.java | 2 +- .../ruoyi/project/benyi/domain/ByChild.java | 145 +++- .../resources/mybatis/benyi/ByChildMapper.xml | 402 ++++++----- 6 files changed, 911 insertions(+), 339 deletions(-) diff --git a/ruoyi-ui/src/api/benyi/child.js b/ruoyi-ui/src/api/benyi/child.js index 6d8ad455f..c72ca6e39 100644 --- a/ruoyi-ui/src/api/benyi/child.js +++ b/ruoyi-ui/src/api/benyi/child.js @@ -35,6 +35,15 @@ export function updateChild(data) { }) } +// 修改幼儿信息 +export function updateChild_tb(data,id) { + return request({ + url: '/benyi/child/'+id, + method: 'put', + data: data + }) +} + // 删除幼儿信息 export function delChild(id) { return request({ diff --git a/ruoyi-ui/src/views/benyi/child/index.vue b/ruoyi-ui/src/views/benyi/child/index.vue index 54fef4bf2..c28ab7028 100644 --- a/ruoyi-ui/src/views/benyi/child/index.vue +++ b/ruoyi-ui/src/views/benyi/child/index.vue @@ -9,19 +9,37 @@ size="small" @keyup.enter.native="handleQuery" /> - + - - + style="width: 240px" + > + + + - - + + @@ -60,53 +78,32 @@ v-hasPermi="['benyi:child:remove']" >删除 + + 调班 + - - + + - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - + + + @@ -136,130 +133,213 @@ /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 请选择字典生成 - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{dict.dictLabel}} + + + + + + + + + + + + + + {{dict.dictLabel}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -269,13 +349,39 @@ import { getChild, delChild, addChild, - updateChild + updateChild, + updateChild_tb } from "@/api/benyi/child"; +import { listClass } from "@/api/system/class"; + +//导入省市区三级联动库 +import VDistpicker from "v-distpicker"; + export default { name: "Child", data() { return { + placeholders: { + province: "请选择省", + city: "请选择市", + area: "请选择区" + }, + diglogForm: { + province: null, + city: null, + area: null + }, + diglogForm1: { + province: null, + city: null, + area: null + }, + diglogForm2: { + province: null, + city: null, + area: null + }, // 遮罩层 loading: true, // 选中数组 @@ -292,6 +398,21 @@ export default { title: "", // 是否显示弹出层 open: false, + open_tb: false, + // 状态数据字典 + statusOptions: [], + // 性别状态字典 + sexOptions: [], + // 民族字典 + mzOptions: [], + //是否字典 + ynOptions: [], + //入园渠道 + sourceOptions: [], + //班级 + classOptions: [], + //是否可编辑 + isable: false, // 查询参数 queryParams: { pageNum: 1, @@ -307,14 +428,23 @@ export default { zjhm: undefined, csrq: undefined, birthProvince: undefined, + birthProvincename: undefined, birthCity: undefined, + birthCityname: undefined, birthArea: undefined, + birthAreaname: undefined, registeredProvince: undefined, + registeredProvincename: undefined, registeredCity: undefined, + registeredCityname: undefined, registeredArea: undefined, + registeredAreaname: undefined, addrProvince: undefined, + addrProvincename: undefined, addrCity: undefined, + addrCityname: undefined, addrArea: undefined, + addrAreaname: undefined, addrDetail: undefined, everSchool: undefined, learnEnglish: undefined, @@ -330,13 +460,81 @@ export default { // 表单参数 form: {}, // 表单校验 - rules: {} + rules: { + name: [ + { required: true, message: "幼儿姓名不能为空", trigger: "blur" } + ], + phone: [ + { required: true, message: "家长手机号码不能为空", trigger: "blur" } + ] + }, + rules_tb: { + classid: [{ required: true, message: "班级不能为空", trigger: "blur" }] + } }; }, created() { this.getList(); + this.getClassList(); + this.getDicts("sys_user_sex").then(response => { + this.sexOptions = response.data; + }); + this.getDicts("sys_normal_disable").then(response => { + this.statusOptions = response.data; + }); + this.getDicts("sys_dm_mz").then(response => { + this.mzOptions = response.data; + }); + this.getDicts("sys_yes_no").then(response => { + this.ynOptions = response.data; + }); + this.getDicts("sys_dm_ryqd").then(response => { + this.sourceOptions = response.data; + }); + }, + components: { + //省市区三级联动全局组件 + VDistpicker }, methods: { + // 性别字典翻译 + xbFormat(row, column) { + return this.selectDictLabel(this.sexOptions, row.xb); + }, + // 字典翻译 + mzFormat(row, column) { + return this.selectDictLabel(this.mzOptions, row.mz); + }, + // 字典翻译 + ynFormat(row, column) { + return this.selectDictLabel(this.ynOptions, row.learnEnglish); + }, + // 字典翻译 + sourceFormat(row, column) { + return this.selectDictLabel(this.sourceOptions, row.source); + }, + // 字典翻译 + statusFormat(row, column) { + return this.selectDictLabel(this.statusOptions, row.status); + }, + // 字典翻译 + classFormat(row, column) { + // return this.selectDictLabel(this.classOptions, row.classid); + var actions = []; + var datas = this.classOptions; + Object.keys(datas).map(key => { + if (datas[key].bjbh == "" + row.classid) { + actions.push(datas[key].bjmc); + return false; + } + }); + return actions.join(""); + }, + getClassList() { + listClass(null).then(response => { + this.classOptions = response.rows; + }); + }, /** 查询幼儿信息列表 */ getList() { this.loading = true; @@ -351,6 +549,11 @@ export default { this.open = false; this.reset(); }, + // 取消按钮 + cancel_tb() { + this.open_tb = false; + this.reset(); + }, // 表单重置 reset() { this.form = { @@ -366,17 +569,26 @@ export default { zjhm: undefined, csrq: undefined, birthProvince: undefined, + birthProvincename: undefined, birthCity: undefined, + birthCityname: undefined, birthArea: undefined, + birthAreaname: undefined, registeredProvince: undefined, + registeredProvincename: undefined, registeredCity: undefined, + registeredCityname: undefined, registeredArea: undefined, + registeredAreaname: undefined, addrProvince: undefined, + addrProvincename: undefined, addrCity: undefined, + addrCityname: undefined, addrArea: undefined, + addrAreaname: undefined, addrDetail: undefined, everSchool: undefined, - learnEnglish: undefined, + learnEnglish: "Y", source: undefined, status: "0", enterDate: undefined, @@ -387,6 +599,19 @@ export default { createuserid: undefined, createTime: undefined }; + + this.diglogForm.province = ""; + this.diglogForm.city = ""; + this.diglogForm.area = ""; + + this.diglogForm1.province = ""; + this.diglogForm1.city = ""; + this.diglogForm1.area = ""; + + this.diglogForm2.province = ""; + this.diglogForm2.city = ""; + this.diglogForm2.area = ""; + this.resetForm("form"); }, /** 搜索按钮操作 */ @@ -417,6 +642,19 @@ export default { const id = row.id || this.ids; getChild(id).then(response => { this.form = response.data; + + this.diglogForm.province = response.data.birthProvincename; + this.diglogForm.city = response.data.birthCityname; + this.diglogForm.area = response.data.birthAreaname; + + this.diglogForm1.province = response.data.registeredProvincename; + this.diglogForm1.city = response.data.registeredCityname; + this.diglogForm1.area = response.data.registeredAreaname; + + this.diglogForm2.province = response.data.addrProvincename; + this.diglogForm2.city = response.data.addrCityname; + this.diglogForm2.area = response.data.addrAreaname; + this.open = true; this.title = "修改幼儿信息"; }); @@ -445,6 +683,28 @@ export default { } }); }, + /** 提交按钮 */ + submitForm_tb: function() { + this.$refs["form"].validate(valid => { + if (valid) { + console.log(this.ids + "---" + this.form.classid); + updateChild_tb(this.form, this.ids).then(response => { + if (response.code === 200) { + this.msgSuccess("调班成功"); + this.open_tb = false; + this.getList(); + } + }); + } + }); + }, + /** 调班按钮操作 */ + handleTiaoban(row) { + this.reset(); + const ids = row.id || this.ids; + //console.log(ids); + this.open_tb = true; + }, /** 删除按钮操作 */ handleDelete(row) { const ids = row.id || this.ids; @@ -465,6 +725,60 @@ export default { this.msgSuccess("删除成功"); }) .catch(function() {}); + }, + //所在省市区触发联动方法 + onSelected_brith(data) { + console.log("onSelected_brith=" + data); + if ( + data.province.code == undefined || + data.city.code == undefined || + data.area.code == undefined + ) { + this.form.birthProvincename = undefined; + } else { + this.form.birthProvincename = data.province.value; + this.form.birthProvince = data.province.code; + this.form.birthCityname = data.city.value; + this.form.birthCity = data.city.code; + this.form.birthAreaname = data.area.value; + this.form.birthArea = data.area.code; + } + }, + //户口所在地 + onSelected_registered(data) { + console.log("onSelected_registered=" + data); + if ( + data.province.code == undefined || + data.city.code == undefined || + data.area.code == undefined + ) { + this.form.registeredProvincename = undefined; + } else { + this.form.registeredProvincename = data.province.value; + this.form.registeredProvince = data.province.code; + this.form.registeredCityname = data.city.value; + this.form.registeredCity = data.city.code; + this.form.registeredAreaname = data.area.value; + this.form.registeredArea = data.area.code; + } + }, + //住址所在地 + onSelected_addr(data) { + console.log("onSelected_addr=" + data); + if ( + data.province.code == undefined || + data.city.code == undefined || + data.area.code == undefined + ) { + this.form.addrProvincename = undefined; + } else { + this.form.addrProvincename = data.province.value; + this.form.addrProvince = data.province.code; + this.form.addrCityname = data.city.value; + this.form.addrCity = data.city.code; + this.form.addrAreaname = data.area.value; + this.form.addrArea = data.area.code; + } } } }; diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByChildController.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByChildController.java index 9c08d4062..cc0129e55 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByChildController.java +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByChildController.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 ByChildController extends BaseController { @Autowired private IByChildService byChildService; + @Autowired + private SchoolCommon schoolCommon; /** * 查询幼儿信息列表 @@ -72,7 +76,20 @@ public class ByChildController extends BaseController { @Log(title = "幼儿信息", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody ByChild byChild) { - return toAjax(byChildService.insertByChild(byChild)); + //首先判断当前账户是否为幼儿园账号 + if (schoolCommon.isSchool()) { + //学校id + byChild.setSchoolid(SecurityUtils.getLoginUser().getUser().getDept().getDeptId()); + //创建人id + byChild.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId()); + //班级id + if (schoolCommon.isStringEmpty(byChild.getClassid())) { + byChild.setClassid(schoolCommon.getClassId()); + } + return toAjax(byChildService.insertByChild(byChild)); + } else { + return AjaxResult.error("当前用户非幼儿园,无法添加幼儿"); + } } /** @@ -85,6 +102,23 @@ public class ByChildController extends BaseController { return toAjax(byChildService.updateByChild(byChild)); } + /** + * 修改幼儿信息 + */ + @PreAuthorize("@ss.hasPermi('benyi:child:edit')") + @Log(title = "幼儿信息", businessType = BusinessType.UPDATE) + @PutMapping("/{ids}") + public AjaxResult edit(@RequestBody ByChild byChild, @PathVariable Long[] ids) { + int iCount = 0; + for (int i = 0; i < ids.length; i++) { + Long id = ids[i]; + System.out.println("classid=" + byChild.getClassid() + " " + "id=" + id); + byChild.setId(id); + iCount = iCount + byChildService.updateByChild(byChild); + } + return toAjax(iCount); + } + /** * 删除幼儿信息 */ diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByThemeController.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByThemeController.java index 931f55df1..83591ea28 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByThemeController.java +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByThemeController.java @@ -68,7 +68,7 @@ public class ByThemeController extends BaseController { /** * 获取主题整合详细信息 */ - @PreAuthorize("@ss.hasPermi('benyi:theme:query')") + @PreAuthorize("@ss.hasPermi('benyi:theme:query')" + "||@ss.hasPermi('benyi:theme:list')") @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { return AjaxResult.success(byThemeService.selectByThemeById(id)); diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/domain/ByChild.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/domain/ByChild.java index 81c3b246e..45183dfc5 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/benyi/domain/ByChild.java +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/domain/ByChild.java @@ -12,7 +12,7 @@ import com.ruoyi.framework.web.domain.BaseEntity; * 幼儿信息对象 by_child * * @author tsbz - * @date 2020-07-20 + * @date 2020-07-21 */ public class ByChild extends BaseEntity { private static final long serialVersionUID = 1L; @@ -32,7 +32,7 @@ public class ByChild extends BaseEntity { * 班级id */ @Excel(name = "班级id") - private Long classid; + private String classid; /** * 姓名 @@ -89,54 +89,108 @@ public class ByChild extends BaseEntity { @Excel(name = "出生所在省") private String birthProvince; + /** + * 出生所在省名称 + */ + @Excel(name = "出生所在省名称") + private String birthProvincename; + /** * 出生所在地市 */ @Excel(name = "出生所在地市") private String birthCity; + /** + * 出生所在市名称 + */ + @Excel(name = "出生所在市名称") + private String birthCityname; + /** * 出生地区 */ @Excel(name = "出生地区") private String birthArea; + /** + * 出生所在区名称 + */ + @Excel(name = "出生所在区名称") + private String birthAreaname; + /** * 户口所在地 */ @Excel(name = "户口所在地") private String registeredProvince; + /** + * 户口所在地名称 + */ + @Excel(name = "户口所在地名称") + private String registeredProvincename; + /** * 户口所在地市 */ @Excel(name = "户口所在地市") private String registeredCity; + /** + * 户口所在市名称 + */ + @Excel(name = "户口所在市名称") + private String registeredCityname; + /** * 户口所在区 */ @Excel(name = "户口所在区") private String registeredArea; + /** + * 户口所在区名称 + */ + @Excel(name = "户口所在区名称") + private String registeredAreaname; + /** * 住址省 */ @Excel(name = "住址省") private String addrProvince; + /** + * 住址省名称 + */ + @Excel(name = "住址省名称") + private String addrProvincename; + /** * 住址市 */ @Excel(name = "住址市") private String addrCity; + /** + * 住址市名称 + */ + @Excel(name = "住址市名称") + private String addrCityname; + /** * 住址区 */ @Excel(name = "住址区") private String addrArea; + /** + * 住址区名称 + */ + @Excel(name = "住址区名称") + private String addrAreaname; + /** * 详细地址 */ @@ -221,11 +275,11 @@ public class ByChild extends BaseEntity { return schoolid; } - public void setClassid(Long classid) { + public void setClassid(String classid) { this.classid = classid; } - public Long getClassid() { + public String getClassid() { return classid; } @@ -301,6 +355,14 @@ public class ByChild extends BaseEntity { return birthProvince; } + public void setBirthProvincename(String birthProvincename) { + this.birthProvincename = birthProvincename; + } + + public String getBirthProvincename() { + return birthProvincename; + } + public void setBirthCity(String birthCity) { this.birthCity = birthCity; } @@ -309,6 +371,14 @@ public class ByChild extends BaseEntity { return birthCity; } + public void setBirthCityname(String birthCityname) { + this.birthCityname = birthCityname; + } + + public String getBirthCityname() { + return birthCityname; + } + public void setBirthArea(String birthArea) { this.birthArea = birthArea; } @@ -317,6 +387,14 @@ public class ByChild extends BaseEntity { return birthArea; } + public void setBirthAreaname(String birthAreaname) { + this.birthAreaname = birthAreaname; + } + + public String getBirthAreaname() { + return birthAreaname; + } + public void setRegisteredProvince(String registeredProvince) { this.registeredProvince = registeredProvince; } @@ -325,6 +403,14 @@ public class ByChild extends BaseEntity { return registeredProvince; } + public void setRegisteredProvincename(String registeredProvincename) { + this.registeredProvincename = registeredProvincename; + } + + public String getRegisteredProvincename() { + return registeredProvincename; + } + public void setRegisteredCity(String registeredCity) { this.registeredCity = registeredCity; } @@ -333,6 +419,14 @@ public class ByChild extends BaseEntity { return registeredCity; } + public void setRegisteredCityname(String registeredCityname) { + this.registeredCityname = registeredCityname; + } + + public String getRegisteredCityname() { + return registeredCityname; + } + public void setRegisteredArea(String registeredArea) { this.registeredArea = registeredArea; } @@ -341,6 +435,14 @@ public class ByChild extends BaseEntity { return registeredArea; } + public void setRegisteredAreaname(String registeredAreaname) { + this.registeredAreaname = registeredAreaname; + } + + public String getRegisteredAreaname() { + return registeredAreaname; + } + public void setAddrProvince(String addrProvince) { this.addrProvince = addrProvince; } @@ -349,6 +451,14 @@ public class ByChild extends BaseEntity { return addrProvince; } + public void setAddrProvincename(String addrProvincename) { + this.addrProvincename = addrProvincename; + } + + public String getAddrProvincename() { + return addrProvincename; + } + public void setAddrCity(String addrCity) { this.addrCity = addrCity; } @@ -357,6 +467,14 @@ public class ByChild extends BaseEntity { return addrCity; } + public void setAddrCityname(String addrCityname) { + this.addrCityname = addrCityname; + } + + public String getAddrCityname() { + return addrCityname; + } + public void setAddrArea(String addrArea) { this.addrArea = addrArea; } @@ -365,6 +483,14 @@ public class ByChild extends BaseEntity { return addrArea; } + public void setAddrAreaname(String addrAreaname) { + this.addrAreaname = addrAreaname; + } + + public String getAddrAreaname() { + return addrAreaname; + } + public void setAddrDetail(String addrDetail) { this.addrDetail = addrDetail; } @@ -468,14 +594,23 @@ public class ByChild extends BaseEntity { .append("zjhm", getZjhm()) .append("csrq", getCsrq()) .append("birthProvince", getBirthProvince()) + .append("birthProvincename", getBirthProvincename()) .append("birthCity", getBirthCity()) + .append("birthCityname", getBirthCityname()) .append("birthArea", getBirthArea()) + .append("birthAreaname", getBirthAreaname()) .append("registeredProvince", getRegisteredProvince()) + .append("registeredProvincename", getRegisteredProvincename()) .append("registeredCity", getRegisteredCity()) + .append("registeredCityname", getRegisteredCityname()) .append("registeredArea", getRegisteredArea()) + .append("registeredAreaname", getRegisteredAreaname()) .append("addrProvince", getAddrProvince()) + .append("addrProvincename", getAddrProvincename()) .append("addrCity", getAddrCity()) + .append("addrCityname", getAddrCityname()) .append("addrArea", getAddrArea()) + .append("addrAreaname", getAddrAreaname()) .append("addrDetail", getAddrDetail()) .append("everSchool", getEverSchool()) .append("learnEnglish", getLearnEnglish()) @@ -490,4 +625,4 @@ public class ByChild extends BaseEntity { .append("createTime", getCreateTime()) .toString(); } -} +} \ No newline at end of file diff --git a/ruoyi/src/main/resources/mybatis/benyi/ByChildMapper.xml b/ruoyi/src/main/resources/mybatis/benyi/ByChildMapper.xml index efd8b10d3..f20798d54 100644 --- a/ruoyi/src/main/resources/mybatis/benyi/ByChildMapper.xml +++ b/ruoyi/src/main/resources/mybatis/benyi/ByChildMapper.xml @@ -5,78 +5,119 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - select id, schoolid, classid, name, en_name, infant_name, phone, xb, mz, zjhm, csrq, birth_province, birth_city, birth_area, registered_province, registered_city, registered_area, addr_province, addr_city, addr_area, addr_detail, ever_school, learn_english, source, status, enter_date, out_date, first_language, seconder_language, other_language, createuserid, create_time from by_child + select id, schoolid, classid, name, en_name, infant_name, phone, xb, mz, zjhm, csrq, birth_province, birth_provincename, birth_city, birth_cityname, birth_area, birth_areaname, registered_province, registered_provincename, registered_city, registered_cityname, registered_area, registered_areaname, addr_province, addr_provincename, addr_city, addr_cityname, addr_area, addr_areaname, addr_detail, ever_school, learn_english, source, status, enter_date, out_date, first_language, seconder_language, other_language, createuserid, create_time from by_child