approveWagonPleaseAdd.vue 3.4 KB

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