<template>
  <!-- 修改通知信息 -->
  <div id="contractDetails">
    <page-title>编辑</page-title>
<!--    <div class="main">
      <span class="text">通知信息</span>
    </div>-->
    <!--class="contractTitle"-->
    <div>
      <div class="form-box">
        <div class="form-one">
          <dil-form :formId="392" v-model="form1"></dil-form>
        </div>
      </div>
    </div>

    <div class="button-box">
      <el-button type="primary" @click="onClickConfirm">确认</el-button>
      <el-button @click="onClickCancel">返回</el-button>
    </div>
  </div>
</template>




<script>


import { getCookie } from '@/utils/util.js'
import PageTitle from "@/components/Page/Title";
export default {
  components: { PageTitle },
  data() {
    return {
      form1: {},
      userId:''
    };
  },

  mounted() {
    let userId=getCookie('userId');
    console.log("修改页面"+userId)
    console.log(this.$route)
    this.information();
  },
  methods: {
    information() {
      //编辑
      this.axios
        .post(
          "/api/v1/ams/getNoticeById/" +
          this.$route.params.noticeId
        )
        .then((res) => {
          console.log(res)
          res.data.data.forEach((e) => {
            this.form1 = e;
            console.log(e);
            console.log(this.form1);
            console.log(this.$route.params.noticeId);
          });
        });
    },
    // 返回
    onClickCancel() {
      this.$router.go(-1);
    },
    // 确认
    onClickConfirm() {
      console.log(this.form1)
      let DilNotice = {
        noticeId:this.form1.noticeId,
        insertTime:this.form1.insertTime,
        insertUsername:this.form1.insertUsername,
        noticeContent:this.form1.noticeContent,
        permission:this.form1.permission,
        noticeTitle:this.form1.noticeTitle,
        userId:this.userId
      };
      this.axios
        .post(
          "/api/v1/ams/updateNotice",
          DilNotice
        )
        .then((res) => {
          if (res.data.code == "200") {
            this.$router.go(-1);
          }
        });
    },
  },
};
</script>
<style lang="scss" scoped>
.form-box{
    .el-form{
      margin-top: 100px;
      .preview-group{
        width: 500px;
        .el-form-item{
          height: 60px;
        }
      }
    }
}
.from {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 5px;
  margin-bottom: 20px;
}
.button-box{
  display: flex;
  text-align: center;
  align-items: center;
  justify-content: center;
  margin-top: 0.3125rem;
  margin-bottom: 1.25rem;
}
</style>

<style>

.el-textarea__inner{
/*  width: 300px !important;*/
  min-height:250px !important;
}


</style>




