addNotice2.vue 2.2 KB

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