addApproveWagonPlease.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <template>
  2. <!-- 新增批车作业页面 -->
  3. <div id="trainTransport">
  4. <page-title>返回</page-title>
  5. <dilTable v-bind.sync="option" v-model="table1" @change="handleCheckedCitiesChange"
  6. ref="table" @radio-change="currentRadioChange">
  7. </dilTable>
  8. <div class="form">
  9. <!-- 第二部分 -->
  10. <div class="form_box">
  11. <dil-form :formId="105" v-model="form1"></dil-form>
  12. </div>
  13. </div>
  14. <div class="button_box">
  15. <el-button @click="onClickCancel">返回</el-button>
  16. <el-button type="primary" @click="onClickConfirm">确认</el-button>
  17. </div>
  18. </div>
  19. </template>
  20. <script>
  21. import PageTitle from "@/components/Page/Title";
  22. import { sjTime, isNumber } from "@/utils/sharedJsFile";
  23. export default {
  24. components: { PageTitle },
  25. data() {
  26. return {
  27. option: {
  28. // 表格请求数据的地址
  29. requestUrl:
  30. "/api/v1/tms/getAllWagonPlease?apiId=57&status=1&resultType=1",
  31. // 控制显示当选列
  32. selectionType: "radio",
  33. },
  34. // 表单
  35. form1: {},
  36. // 表格
  37. table1: {},
  38. contractId: "",
  39. inf: {},
  40. };
  41. },
  42. mounted() {
  43. // this.unit();
  44. },
  45. methods: {
  46. onclick(){
  47. },
  48. handleCheckedCitiesChange(value) {
  49. console.log(value);
  50. },
  51. // 返回
  52. onClickCancel() {
  53. this.$router.go(-1);
  54. },
  55. currentRadioChange(row) {
  56. this.inf = row;
  57. },
  58. // 确认
  59. onClickConfirm() {
  60. let approveWagonPlease = {
  61. resultId: this.inf.resultId,
  62. resultApproveDate: sjTime(this.form1.resultApproveDate),
  63. resultApproveNumber: this.form1.resultApproveNumber,
  64. };
  65. function isNumber() {
  66. var value = approveWagonPlease.resultApproveNumber;
  67. //验证是否为数字
  68. var patrn = /^(-)?\d+(\.\d+)?$/;
  69. if (patrn.exec(value) == null || value == "") {
  70. return false;
  71. } else {
  72. return true;
  73. }
  74. }
  75. var val = this.value;
  76. if (
  77. approveWagonPlease.resultId == null ||
  78. approveWagonPlease.resultApproveDate == null ||
  79. approveWagonPlease.resultApproveNumber == null
  80. )
  81. this.$message.error("存在空值!");
  82. else if (!isNumber(val)) this.$message.error("请车数量必须是数字!");
  83. else console.log(approveWagonPlease);
  84. this.axios
  85. .post("/api/v1/tms/addApproveWagonPlease", approveWagonPlease)
  86. .then(() => {
  87. this.$message({
  88. type: "success",
  89. message: "新增成功!",
  90. });
  91. this.$router.go(-1);
  92. });
  93. },
  94. },
  95. };
  96. </script>
  97. <style lang="scss">
  98. #trainTransport {
  99. .form {
  100. display: flex;
  101. .form_box {
  102. width: 340px;
  103. margin-left: 35%;
  104. margin-top: 30px;
  105. margin-right: 20px;
  106. .el-form {
  107. .preview-group {
  108. .el-form-item {
  109. .el-form-item__label {
  110. display: inline-block;
  111. width: 70px !important;
  112. }
  113. .el-form-item__content {
  114. .el-select {
  115. width: 250px;
  116. }
  117. .el-input {
  118. width: 250px;
  119. }
  120. }
  121. }
  122. }
  123. }
  124. }
  125. }
  126. .button_box {
  127. margin-left: 42%;
  128. margin-top: 55px;
  129. }
  130. }
  131. </style>