editOilPrice.vue 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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="356" 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/getOilPriceById/" +
  40. this.$route.params.priceId
  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.priceId);
  49. });
  50. });
  51. },
  52. // 返回
  53. onClickCancel() {
  54. this.$router.go(-1);
  55. },
  56. // 确认
  57. onClickConfirm() {
  58. console.log(this.form1)
  59. let RmsOilPrice = {
  60. priceId:this.form1.priceId,
  61. priceDate:this.form1.priceDate,
  62. priceValue:this.form1.priceValue,
  63. priceOilName:this.form1.priceOilName,
  64. };
  65. if(
  66. RmsOilPrice.priceOilName ==null ||
  67. RmsOilPrice.priceDate ==null ||
  68. RmsOilPrice.priceValue ==null
  69. )this.$message.error("存在空值!");
  70. this.axios
  71. .post(
  72. "/api/v1/rms/updateOilPrice",
  73. RmsOilPrice
  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. text-align: center;
  89. align-items: center;
  90. justify-content: center;
  91. margin-top: 0.3125rem;
  92. margin-bottom: 1.25rem;
  93. }
  94. </style>