approveWagonPleaseEdit.vue 3.1 KB

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