addNotice.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <template>
  2. <!-- 添加公告信息 class="addWagonLoad" -->
  3. <div>
  4. <PageTitle>返回</PageTitle>
  5. <div class="form-box" style="margin-right: 10rem;width: 1200px">
  6. <dil-form :formId="391" v-model="form1" ref="from1">
  7. </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 { getCookie } from '@/utils/util.js'
  17. import PageTitle from "@/components/Page/Title";
  18. export default {
  19. components: { PageTitle },
  20. data() {
  21. return {
  22. form1: {
  23. permission:"承运商"
  24. },
  25. value: undefined,
  26. userId:""
  27. };
  28. },
  29. mounted() {
  30. this.userId = getCookie('userId')
  31. /*console.log("新增")
  32. console.log(this.userId)
  33. //this.form1.insertTime=new Date()*/
  34. this.$set(this.form1, 'insertTime',new Date())
  35. this.information()
  36. },
  37. methods: {
  38. async information(){
  39. await this.axios.post("/api/v1/ams/queryName/"+this.userId)
  40. .then((res=>{
  41. console.log(res)
  42. let userName=res.data.data
  43. this.$set(this.form1, 'insertUsername',userName)
  44. }))
  45. },
  46. makeSure() {
  47. console.log(this.form1);
  48. let DilNotice = {
  49. noticeTitle:this.form1.noticeTitle,
  50. insertUsername:this.form1.insertUsername,
  51. noticeContent:this.form1.noticeContent,
  52. permissions:this.form1.permission,
  53. /*这里permissions拿的是描述也就是name值*/
  54. }
  55. this.axios
  56. .post(
  57. "/api/v1/ams/insertNotice",DilNotice
  58. )
  59. .then((res) => {
  60. this.$router.go(-1);
  61. });
  62. },
  63. // 取消
  64. cancel() {
  65. this.$router.go(-1);
  66. },
  67. },
  68. };
  69. </script>
  70. <style lang='scss' scoped>
  71. .from {
  72. display: flex;
  73. align-items: center;
  74. justify-content: center;
  75. margin-top: 5px;
  76. margin-bottom: 20px;
  77. }
  78. .form-box{
  79. .el-form{
  80. margin-top: 100px;
  81. margin-left: 200px;
  82. .preview-group{
  83. .el-form-item{
  84. width: 600px;
  85. height: 60px;
  86. }
  87. }
  88. }
  89. }
  90. .button-box{
  91. display: flex;
  92. text-align: center;
  93. align-items: center;
  94. justify-content: center;
  95. margin-top: 0.3125rem;
  96. margin-bottom: 1.25rem;
  97. }
  98. </style>