editApproveWagonPlease.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <template>
  2. <div class="contractDetails">
  3. <page-title>返回</page-title>
  4. <div class="form">
  5. <div class="form_box">
  6. <dil-form :formId="140" v-model="form1"></dil-form>
  7. </div>
  8. </div>
  9. <div class="button_box">
  10. <el-button @click="onClickCancel">返回</el-button>
  11. <el-button type="primary" @click="onClickConfirm">确认</el-button>
  12. </div>
  13. </div>
  14. </template>
  15. <script>
  16. import PageTitle from "@/components/Page/Title";
  17. import { getCookie } from "@/utils/util.js";
  18. export default {
  19. components: { PageTitle },
  20. data(){
  21. return {
  22. form1: {},
  23. }
  24. },
  25. mounted() {
  26. this.information();
  27. },
  28. methods: {
  29. information() {
  30. //编辑批车作业 渲染数据
  31. this.axios
  32. .post("/api/v1/tms/getApproveWagonPleaseById/" + this.$route.params.resultId)
  33. .then((res) => {
  34. res.data.data.forEach((e) => {
  35. this.form1 = e;
  36. });
  37. });
  38. },
  39. // 返回
  40. onClickCancel() {
  41. this.$router.go(-1);
  42. },
  43. // 确认
  44. onClickConfirm() {
  45. let approveWagonPlease = {
  46. resultId: this.$route.params.resultId,
  47. resultApproveDate: this.form1.resultApproveDate,
  48. resultApproveNumber: this.form1.resultApproveNumber,
  49. // shipperId: this.form1.shipperId,
  50. resultCategory: this.form1.resultCategory,
  51. sendStationId: this.form1.sendStationId,
  52. toTheStationId: this.form1.toTheStationId,
  53. userId:getCookie("orgCode"),
  54. };
  55. function isNumber() {
  56. var value = approveWagonPlease.resultApproveNumber;
  57. //验证是否为数字
  58. var patrn = /^(-)?\d+(\.\d+)?$/;
  59. if (patrn.exec(value) == null || value == "") {
  60. return false;
  61. } else {
  62. return true;
  63. }
  64. }
  65. var val = this.value;
  66. if (
  67. approveWagonPlease.resultApproveDate==null||
  68. approveWagonPlease.resultApproveNumber==null||
  69. // approveWagonPlease.shipperId==null||
  70. approveWagonPlease.resultCategory==null||
  71. approveWagonPlease.sendStationId==null||
  72. approveWagonPlease.toTheStationId==null
  73. ) this.$message.error("存在空值!");
  74. else
  75. if (!isNumber(val)) this.$message.error("请车数必须是数字!");
  76. else
  77. this.axios
  78. .post("/api/v1/tms/updateApproveWagonPlease", approveWagonPlease)
  79. .then(() => {
  80. this.$message({
  81. type: "success",
  82. message: "修改成功!",
  83. });
  84. this.$router.go(-1);
  85. });
  86. },
  87. },
  88. };
  89. </script>
  90. <style lang="scss">
  91. .contractDetails {
  92. .form {
  93. display: flex;
  94. .form_box {
  95. width: 340px;
  96. margin-left: 35%;
  97. margin-top: 30px;
  98. margin-right: 20px;
  99. .el-form {
  100. .preview-group {
  101. .el-form-item {
  102. .el-form-item__label {
  103. display: inline-block;
  104. width: 70px !important;
  105. }
  106. .el-form-item__content {
  107. .el-select {
  108. width: 250px;
  109. }
  110. .el-input {
  111. width: 250px;
  112. }
  113. }
  114. }
  115. }
  116. }
  117. }
  118. }
  119. .button_box {
  120. margin-left: 42%;
  121. margin-top: 55px;
  122. }
  123. }
  124. .fromOther {
  125. margin-left: 34.5%;
  126. width: 50%;
  127. .inline-input {
  128. width: 300px;
  129. }
  130. }
  131. </style>