主题整合月计划

This commit is contained in:
paidaxing444 2020-08-19 21:54:14 +08:00
parent 670f44fce6
commit 006b9c3e6e
2 changed files with 107 additions and 23 deletions
ruoyi-ui/src/views/benyi/thememonthplan
ruoyi/src/main/java/com/ruoyi/project/benyi/controller

@ -11,13 +11,14 @@
/>
</el-form-item>
<el-form-item label="所属班级" prop="classid">
<el-input
v-model="queryParams.classid"
placeholder="请输入所属班级"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
<el-select v-model="queryParams.classid" placeholder="请选择班级">
<el-option
v-for="dict in classOptions"
:key="dict.bjbh"
:label="dict.bjmc"
:value="dict.bjbh"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="学年学期" prop="xnxq">
<el-input
@ -111,24 +112,35 @@
/>
<!-- 添加或修改主题整合月计划对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="计划名称" prop="name">
<el-input v-model="form.name" placeholder="请输入计划名称" />
</el-form-item>
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="90px">
<el-form-item label="所属班级" prop="classid">
<el-input v-model="form.classid" placeholder="请输入所属班级" />
</el-form-item>
<el-form-item label="学年学期" prop="xnxq">
<el-input v-model="form.xnxq" placeholder="请输入学年学期" />
<el-select
v-model="form.classid"
placeholder="请选择班级"
@change="getClassName"
:disabled="disable"
>
<el-option
v-for="dict in classOptions"
:key="dict.bjbh"
:label="dict.bjmc"
:value="dict.bjbh"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="计划月份" prop="month">
<el-input v-model="form.month" placeholder="请输入计划月份" />
<el-date-picker
v-model="form.month"
type="month"
placeholder="选择计划月份"
:disabled="disable"
></el-date-picker>
</el-form-item>
<el-form-item label="本月主题" prop="themes">
<el-form-item label="主题" prop="themes">
<el-input v-model="form.themes" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="本月自定义主题" prop="selfthemes">
<el-form-item label="自定义主题" prop="selfthemes">
<el-input v-model="form.selfthemes" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="家长支持" prop="support">
@ -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) {
//locationsv-fordatas
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;
});
},
/** 提交按钮 */

@ -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("当前用户非幼儿园,无法添加幼儿");
}
}
/**