diff --git a/ruoyi-ui/src/views/benyi/thememonthplan/index.vue b/ruoyi-ui/src/views/benyi/thememonthplan/index.vue index 2f0dccdc3..6f752fbf5 100644 --- a/ruoyi-ui/src/views/benyi/thememonthplan/index.vue +++ b/ruoyi-ui/src/views/benyi/thememonthplan/index.vue @@ -11,13 +11,14 @@ /> - + + + - - - - - + + - - - - + + + - + - + - + @@ -155,6 +167,8 @@ import { updateMonthplan, } from "@/api/benyi/thememonthplan"; +import { listClass } from "@/api/system/class"; + export default { name: "Monthplan", data() { @@ -169,8 +183,12 @@ export default { multiple: true, // 总条数 total: 0, + //是否 + disable: false, // 主题整合月计划表格数据 monthplanList: [], + //班级 + classOptions: [], // 弹出层标题 title: "", // 是否显示弹出层 @@ -192,13 +210,48 @@ export default { // 表单参数 form: {}, // 表单校验 - rules: {}, + rules: { + classid: [{ required: true, message: "班级不能为空", trigger: "blur" }], + month: [ + { required: true, message: "计划月份不能为空", trigger: "blur" }, + ], + themes: [{ required: true, message: "主题不能为空", trigger: "blur" }], + }, }; }, created() { this.getList(); + this.getClassList(); }, methods: { + getClassName(val) { + //locations是v-for里面的也是datas里面的值 + let obj = {}; + obj = this.classOptions.find((item) => { + return item.bjbh === val; + }); + let getName = ""; + getName = obj.bjmc; + this.form.name = getName; + }, + // 字典翻译 + 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; @@ -250,7 +303,8 @@ export default { handleAdd() { this.reset(); this.open = true; - this.title = "添加主题整合月计划"; + this.title = "添加<主题整合>月计划"; + this.disable = false; }, /** 修改按钮操作 */ handleUpdate(row) { @@ -259,7 +313,8 @@ export default { getMonthplan(id).then((response) => { this.form = response.data; this.open = true; - this.title = "修改主题整合月计划"; + this.title = "修改<主题整合>月计划"; + this.disable = true; }); }, /** 提交按钮 */ diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByThemeMonthplanController.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByThemeMonthplanController.java index 8008cee8a..cb76c8fb6 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByThemeMonthplanController.java +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByThemeMonthplanController.java @@ -1,7 +1,12 @@ package com.ruoyi.project.benyi.controller; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; 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 +37,8 @@ import com.ruoyi.framework.web.page.TableDataInfo; public class ByThemeMonthplanController extends BaseController { @Autowired private IByThemeMonthplanService byThemeMonthplanService; + @Autowired + private SchoolCommon schoolCommon; /** * 查询主题整合月计划列表 @@ -72,7 +79,29 @@ public class ByThemeMonthplanController extends BaseController { @Log(title = "主题整合月计划", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody ByThemeMonthplan byThemeMonthplan) { - return toAjax(byThemeMonthplanService.insertByThemeMonthplan(byThemeMonthplan)); + //首先判断当前账户是否为幼儿园账号 + if (schoolCommon.isSchool()) { + + byThemeMonthplan.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId()); + + String dateTime = byThemeMonthplan.getMonth(); + dateTime = dateTime .replace("Z", " UTC"); //2019-06-27T16:00:00.000 UTC + SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS Z");//转换时区格式 + SimpleDateFormat format2 = new SimpleDateFormat("yyyy-MM"); + Date date = null;//将Z时间格式转换成Date类型格式或换成毫秒 + try { + date = format1.parse(dateTime); + } catch (ParseException e) { + e.printStackTrace(); + } + String time= format2.format(date);//2019-06 + System.out.println(time); + byThemeMonthplan.setMonth(time); + byThemeMonthplan.setName(byThemeMonthplan.getName() + "-主题整合月计划(" + byThemeMonthplan.getMonth() + ")"); + return toAjax(byThemeMonthplanService.insertByThemeMonthplan(byThemeMonthplan)); + } else { + return AjaxResult.error("当前用户非幼儿园,无法添加幼儿"); + } } /**