addNotice.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <template>
  2. <!-- 添加公告信息 -->
  3. <div class="addWagonLoad">
  4. <PageTitle>返回</PageTitle>
  5. <el-divider content-position="left">公告信息</el-divider>
  6. <div class="form-box" style="margin-right: 10rem">
  7. <dil-form :formId="302" v-model="form1" ref="from1"></dil-form>
  8. </div>
  9. <div class="button-box">
  10. <el-button @click="cancel">取消</el-button>
  11. <el-button type="primary" @click="makeSure">确定</el-button>
  12. </div>
  13. </div>
  14. </template>
  15. <script>
  16. import PageTitle from "@/components/Page/Title";
  17. export default {
  18. components: { PageTitle },
  19. data() {
  20. return {
  21. form1: {},
  22. value: undefined,
  23. };
  24. },
  25. mounted() {},
  26. methods: {
  27. makeSure() {
  28. console.log(this.form1);
  29. let DilNotice = {
  30. noticeTitle:this.form1.noticeTitle,
  31. insertUsername:this.form1.insertUsername,
  32. noticeContent:this.form1.noticeContent,
  33. };
  34. if(
  35. DilNotice.noticeTitle ==null ||
  36. DilNotice.insertUsername ==null ||
  37. DilNotice.noticeContent ==null
  38. )this.$message.error("存在空值!");
  39. else
  40. this.axios
  41. .post(
  42. "/api/v1/rms/insertNotice",DilNotice
  43. )
  44. .then((res) => {
  45. if (res.data.code == 200) {
  46. this.$message({
  47. type: "success",
  48. message: "新增成功!",
  49. });
  50. // this.$refs.table.refreshData();
  51. this.$router.go(-1);
  52. } else {
  53. this.$message.error("新增失败,可能存在重复!");
  54. }
  55. this.$refs['table'].resetField();
  56. });
  57. },
  58. // 取消
  59. cancel() {
  60. this.$router.go(-1);
  61. },
  62. },
  63. };
  64. </script>
  65. <style lang='scss' scoped>
  66. .form-box,
  67. .button-box{
  68. display: flex;
  69. text-align: center;
  70. align-items: center;
  71. justify-content: center;
  72. margin-top: 0.3125rem;
  73. margin-bottom: 1.25rem;
  74. }
  75. </style>