addOilPrice.vue 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <!-- 添加油价信息 -->
  3. <div class="addWagonLoad">
  4. <PageTitle>返回</PageTitle>
  5. <div class="form-box" style="margin-right: 10rem">
  6. <dil-form :formId="357" 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 PageTitle from "@/components/Page/Title";
  16. export default {
  17. components: { PageTitle },
  18. data() {
  19. return {
  20. form1: {},
  21. value: undefined,
  22. };
  23. },
  24. mounted() {},
  25. methods: {
  26. makeSure() {
  27. console.log(this.form1);
  28. let RmsOilPrice = {
  29. priceOilName:this.form1.priceOilName,
  30. priceId:this.form1.priceId,
  31. priceDate:this.form1.priceDate,
  32. priceValue:this.form1.priceValue,
  33. };
  34. if(
  35. RmsOilPrice.priceOilName ==null ||
  36. RmsOilPrice.priceDate ==null ||
  37. RmsOilPrice.priceValue ==null
  38. )this.$message.error("存在空值!");
  39. else
  40. this.axios
  41. .post(
  42. "/api/v1/rms/insertOilPrice" , RmsOilPrice
  43. )
  44. .then((res) => {
  45. if (res.data.code == 200) {
  46. this.$message({
  47. type: "success",
  48. message: "新增成功!",
  49. });
  50. // this.$refs.table.refreshData();
  51. this.$router.go(-1);
  52. } else {
  53. this.$message.error("新增失败,可能存在重复!");
  54. }
  55. // this.$refs['table'].resetField();
  56. });
  57. },
  58. // 取消
  59. cancel() {
  60. this.$router.go(-1);
  61. },
  62. },
  63. };
  64. </script>
  65. <style lang='scss' >
  66. .button-box{
  67. display: flex;
  68. justify-content: center;
  69. .el-button{
  70. width: 80px;
  71. margin-right: 10px;
  72. }
  73. }
  74. .form-box{
  75. display: flex;
  76. justify-content: center;
  77. .el-form-item{
  78. display: flex;
  79. justify-content: center;
  80. .el-form-item__label{
  81. display: flex;
  82. align-items: center;
  83. }
  84. .el-form-item__content{
  85. .el-input{
  86. .el-input__inner{
  87. width: 250px;
  88. }
  89. }
  90. }
  91. }
  92. }
  93. </style>