editApproveWagonPlease.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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. import { sjTime } 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("/api/v1/tms/getApproveWagonPleaseById/" + this.$route.params.resultId)
  34. .then((res) => {
  35. res.data.data.forEach((e) => {
  36. this.form1 = e;
  37. });
  38. });
  39. },
  40. // 返回
  41. onClickCancel() {
  42. this.$router.go(-1);
  43. },
  44. // 确认
  45. onClickConfirm() {
  46. let approveWagonPlease = {
  47. resultId: this.$route.params.resultId,
  48. resultApproveDate: sjTime(this.form1.resultApproveDate),
  49. resultApproveNumber: this.form1.resultApproveNumber,
  50. // shipperId: this.form1.shipperId,
  51. resultCategory: this.form1.resultCategory,
  52. userId:getCookie("orgCode"),
  53. };
  54. function isNumber() {
  55. var value = approveWagonPlease.resultApproveNumber;
  56. //验证是否为数字
  57. var patrn = /^(-)?\d+(\.\d+)?$/;
  58. if (patrn.exec(value) == null || value == "") {
  59. return false;
  60. } else {
  61. return true;
  62. }
  63. }
  64. var val = this.value;
  65. if (
  66. approveWagonPlease.resultApproveDate==null||
  67. approveWagonPlease.resultApproveNumber==null||
  68. // approveWagonPlease.shipperId==null||
  69. approveWagonPlease.resultCategory==null
  70. ) this.$message.error("存在空值!");
  71. else
  72. if (!isNumber(val)) this.$message.error("请车数必须是数字!");
  73. else
  74. this.axios
  75. .post("/api/v1/tms/updateApproveWagonPlease", approveWagonPlease)
  76. .then(() => {
  77. this.$message({
  78. type: "success",
  79. message: "修改成功!",
  80. });
  81. this.$router.go(-1);
  82. });
  83. },
  84. },
  85. };
  86. </script>
  87. <style lang="scss">
  88. .contractDetails {
  89. .form {
  90. display: flex;
  91. .form_box {
  92. width: 340px;
  93. margin-left: 35%;
  94. margin-top: 30px;
  95. margin-right: 20px;
  96. .el-form {
  97. .preview-group {
  98. .el-form-item {
  99. .el-form-item__label {
  100. display: inline-block;
  101. width: 70px !important;
  102. }
  103. .el-form-item__content {
  104. .el-select {
  105. width: 250px;
  106. }
  107. .el-input {
  108. width: 250px;
  109. }
  110. }
  111. }
  112. }
  113. }
  114. }
  115. }
  116. .button_box {
  117. margin-left: 42%;
  118. margin-top: 55px;
  119. }
  120. }
  121. .fromOther {
  122. margin-left: 34.5%;
  123. width: 50%;
  124. .inline-input {
  125. width: 300px;
  126. }
  127. }
  128. </style>