editNotice.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <!-- 修改通知信息 -->
  3. <div id="contractDetails">
  4. <page-title>编辑</page-title>
  5. <div class="main">
  6. <span class="text">通知信息</span>
  7. </div>
  8. <div class="contractTitle">
  9. <div class="form-box">
  10. <div class="form-one">
  11. <dil-form :formId="302" v-model="form1"></dil-form>
  12. </div>
  13. </div>
  14. </div>
  15. <div class="button-box">
  16. <el-button type="primary" @click="onClickConfirm">确认</el-button>
  17. <el-button @click="onClickCancel">返回</el-button>
  18. </div>
  19. </div>
  20. </template>
  21. <script>
  22. import PageTitle from "@/components/Page/Title";
  23. export default {
  24. components: { PageTitle },
  25. data() {
  26. return {
  27. form1: {},
  28. };
  29. },
  30. mounted() {
  31. console.log(this.$route)
  32. this.information();
  33. },
  34. methods: {
  35. information() {
  36. //编辑
  37. this.axios
  38. .post(
  39. "/api/v1/rms/getNoticeById/" +
  40. this.$route.params.noticeId
  41. )
  42. .then((res) => {
  43. console.log(res)
  44. res.data.data.forEach((e) => {
  45. this.form1 = e;
  46. console.log(e);
  47. console.log(this.form1);
  48. console.log(this.$route.params.noticeId);
  49. });
  50. });
  51. },
  52. // 返回
  53. onClickCancel() {
  54. this.$router.go(-1);
  55. },
  56. // 确认
  57. onClickConfirm() {
  58. console.log(this.form1)
  59. let DilNotice = {
  60. noticeId:this.form1.noticeId,
  61. insertTime:this.form1.insertTime,
  62. insertUsername:this.form1.insertUsername,
  63. noticeContent:this.form1.noticeContent,
  64. };
  65. if(
  66. DilNotice.noticeTitle ==null ||
  67. DilNotice.insertUsername ==null ||
  68. DilNotice.noticeContent ==null
  69. )this.$message.error("存在空值!");
  70. this.axios
  71. .post(
  72. "/api/v1/rms/updateNotice",
  73. DilNotice
  74. )
  75. .then((res) => {
  76. if (res.data.code == "200") {
  77. this.$router.go(-1);
  78. }
  79. });
  80. },
  81. },
  82. };
  83. </script>
  84. <style lang='scss' scoped>
  85. .form-box,
  86. .button-box{
  87. display: flex;
  88. justify-content: center;
  89. .el-button{
  90. width: 80px;
  91. margin-right: 10px;
  92. }
  93. }
  94. </style>