|
@@ -2,23 +2,44 @@
|
|
|
<div>
|
|
|
<div class="body">
|
|
|
<div class="s-body">
|
|
|
- <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
|
|
|
- <el-form-item label="公告名称: " prop="name">
|
|
|
- <el-input v-model="ruleForm.name"></el-input>
|
|
|
+ <el-form
|
|
|
+ :model="ruleForm"
|
|
|
+ :rules="rules"
|
|
|
+ ref="ruleForm"
|
|
|
+ label-width="100px"
|
|
|
+ class="demo-ruleForm"
|
|
|
+ >
|
|
|
+ <el-form-item label="公告名称: " prop="noticeTitle">
|
|
|
+ <el-input v-model="ruleForm.noticeTitle"></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="发布时间: " required>
|
|
|
- <el-date-picker v-model="ruleForm.date" type="date" placeholder="选择日期">
|
|
|
+ <el-form-item label="发布时间: " required prop="createTime">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="ruleForm.createTime"
|
|
|
+ type="datetime"
|
|
|
+ placeholder="选择日期时间"
|
|
|
+ value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
+ >
|
|
|
</el-date-picker>
|
|
|
- <el-time-picker placeholder="选择时间" v-model="ruleForm.time"></el-time-picker>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="公告内容: " prop="name">
|
|
|
- <mavon-editor ref="md" v-model="notice.noticeContent" style="height: calc(100vh - 400px)" />
|
|
|
+ <el-form-item label="公告内容: " prop="noticeTitle">
|
|
|
+ <mavon-editor
|
|
|
+ ref="md"
|
|
|
+ v-model="ruleForm.noticeContent"
|
|
|
+ style="height: calc(100vh - 400px)"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
- <el-button type="danger" @click="confirmGG" style="float: right">发布公告</el-button>
|
|
|
+ <el-button type="danger" @click="confirmGG" style="float: right"
|
|
|
+ >发布公告</el-button
|
|
|
+ >
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
- <el-dialog title="提示" :visible.sync="dialogVisible" width="20%" :before-close="handleClose">
|
|
|
+ <el-dialog
|
|
|
+ title="提示"
|
|
|
+ :visible.sync="dialogVisible"
|
|
|
+ width="20%"
|
|
|
+ :before-close="handleClose"
|
|
|
+ >
|
|
|
<span>确认发布公告吗?</span>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
<el-button @click="cancel">取 消</el-button>
|
|
@@ -31,29 +52,34 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { addNotice } from '../../api/notice/notice'
|
|
|
+import { addNotice } from "../../api/notice/notice";
|
|
|
+
|
|
|
export default {
|
|
|
name: "Addnotice",
|
|
|
data() {
|
|
|
return {
|
|
|
ruleForm: {
|
|
|
- name: '',
|
|
|
- date: '',
|
|
|
- time: '',
|
|
|
+ noticeTitle: "",
|
|
|
+ // date: "",
|
|
|
+ // time: "",
|
|
|
+ createTime: "",
|
|
|
+ noticeContent: "",
|
|
|
},
|
|
|
notice: {
|
|
|
noticeContent: "",
|
|
|
},
|
|
|
rules: {
|
|
|
- name: [
|
|
|
- { required: true, message: '请输入公告名称', trigger: 'blur' },
|
|
|
+ noticeTitle: [
|
|
|
+ { required: true, message: "请输入公告名称", trigger: "blur" },
|
|
|
],
|
|
|
- date: [
|
|
|
- { required: true, type: 'date', message: '请选择日期', trigger: 'change' }
|
|
|
+ createTime: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ // type: "date",
|
|
|
+ message: "请选择日期",
|
|
|
+ trigger: "change",
|
|
|
+ },
|
|
|
],
|
|
|
- time: [
|
|
|
- { required: true, type: 'date', message: '请选择时间', trigger: 'change' }
|
|
|
- ]
|
|
|
},
|
|
|
dialogVisible: false,
|
|
|
};
|
|
@@ -63,40 +89,33 @@ export default {
|
|
|
submitForm() {
|
|
|
this.$refs.ruleForm.validate((valid) => {
|
|
|
if (valid) {
|
|
|
- let nyr = this.$formatDate(this.ruleForm.date, 'yyyy-MM-dd');
|
|
|
- let sfm = this.$formatDate(this.ruleForm.time, 'hh:mm:ss');
|
|
|
- let notice = {
|
|
|
- noticeTitle: this.ruleForm.name,
|
|
|
- noticeContent: this.notice.noticeContent,
|
|
|
- createTime: nyr + ' ' + sfm
|
|
|
- }
|
|
|
- addNotice(notice).then(() => {
|
|
|
- this.ruleForm.name = '';
|
|
|
- this.ruleForm.date = '';
|
|
|
- this.ruleForm.time = '';
|
|
|
- this.notice.noticeContent = '';
|
|
|
- })
|
|
|
+ addNotice(this.ruleForm).then(() => {
|
|
|
+ this.ruleForm.name = "";
|
|
|
+ this.ruleForm.createTime = "";
|
|
|
+ this.ruleForm.noticeContent = "";
|
|
|
+ });
|
|
|
this.$notify({
|
|
|
- title: '成功',
|
|
|
- message: '创建消息成功',
|
|
|
- type: 'success'
|
|
|
+ title: "成功",
|
|
|
+ message: "创建消息成功",
|
|
|
+ type: "success",
|
|
|
});
|
|
|
this.$router.push("./noticeList");
|
|
|
} else {
|
|
|
this.$notify({
|
|
|
- title: '警告',
|
|
|
- message: '请填写内容',
|
|
|
- type: 'warning'
|
|
|
+ title: "警告",
|
|
|
+ message: "请填写内容",
|
|
|
+ type: "warning",
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
- this.dialogVisible = false
|
|
|
+
|
|
|
+ this.dialogVisible = false;
|
|
|
},
|
|
|
cancel() {
|
|
|
- this.dialogVisible = false
|
|
|
+ this.dialogVisible = false;
|
|
|
},
|
|
|
confirmGG() {
|
|
|
- this.dialogVisible = true
|
|
|
+ this.dialogVisible = true;
|
|
|
},
|
|
|
resetForm(formName) {
|
|
|
this.$refs[formName].resetFields();
|
|
@@ -106,7 +125,7 @@ export default {
|
|
|
.then((_) => {
|
|
|
done();
|
|
|
})
|
|
|
- .catch((_) => { });
|
|
|
+ .catch((_) => {});
|
|
|
},
|
|
|
},
|
|
|
};
|