addWagonPlease.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <template>
  2. <!-- 新增请作业页面 -->
  3. <div class="trainTransport">
  4. <page-title>返回</page-title>
  5. <div class="form">
  6. <div class="form_box">
  7. <dil-form :formId="122" v-model="form1" ref="from1"></dil-form>
  8. </div>
  9. </div>
  10. <!-- 确定和取消 -->
  11. <div class="button_box">
  12. <el-button @click="onClickCancel">返回</el-button>
  13. <el-button type="primary" @click="onClickConfirm" >确认</el-button>
  14. </div>
  15. </div>
  16. </template>
  17. <script>
  18. import PageTitle from "@/components/Page/Title";
  19. export default {
  20. components: { PageTitle },
  21. data() {
  22. return {
  23. // 表单
  24. form1: {},
  25. };
  26. },
  27. mounted() {
  28. // this.unit();
  29. },
  30. methods: {
  31. handleCheckedCitiesChange(value) {
  32. console.log(value);
  33. },
  34. // 返回
  35. onClickCancel() {
  36. this.$router.go(-1);
  37. },
  38. // 确认
  39. onClickConfirm() {
  40. let tmstrainPleaseApproveResult = {
  41. resultPlanDate: sjTime(this.form1.resultPlanDate),
  42. resultCategory: this.form1.resultCategory,
  43. shipperId: this.form1.shipperId,
  44. sendStationId: this.form1.sendStationId,
  45. toTheStationId: this.form1.toTheStationId,
  46. resultPleaseNumber: this.form1.resultPleaseNumber,
  47. insertUsername: "admin",
  48. resultType: 1
  49. };
  50. function isNumber() {
  51. var value = tmstrainPleaseApproveResult.resultPleaseNumber;
  52. //验证是否为数字
  53. var patrn = /^(-)?\d+(\.\d+)?$/;
  54. if (patrn.exec(value) == null || value == "") {
  55. return false;
  56. } else {
  57. return true;
  58. }
  59. }
  60. var val = this.value;
  61. if (
  62. tmstrainPleaseApproveResult.resultPlanDate==null||
  63. tmstrainPleaseApproveResult.resultCategory==null||
  64. tmstrainPleaseApproveResult.shipperId==null||
  65. tmstrainPleaseApproveResult.sendStationId==null||
  66. tmstrainPleaseApproveResult.toTheStationId==null||
  67. tmstrainPleaseApproveResult.resultPleaseNumber==null
  68. ) this.$message.error("存在空值!");
  69. else
  70. if (!isNumber(val)) this.$message.error("请车数量必须是数字!");
  71. else
  72. this.axios
  73. .post("/api/v1/tms/addWagonPlease", tmstrainPleaseApproveResult)
  74. .then(() => {
  75. this.$message({
  76. type: "success",
  77. message: "新增成功!",
  78. });
  79. this.$router.go(-1);
  80. });
  81. },
  82. },
  83. };
  84. </script>
  85. <style lang="scss">
  86. .trainTransport{
  87. .form{
  88. display: flex;
  89. .form_box{
  90. width: 320px;
  91. margin-left: 35%;
  92. margin-top: 30px;
  93. margin-right: 20px;
  94. .el-form{
  95. .preview-group{
  96. .el-form-item{
  97. .el-form-item__label{
  98. display: inline-block;
  99. width: 70px !important;
  100. }
  101. .el-form-item__content{
  102. .el-select{
  103. width: 250px;
  104. }
  105. .el-input{
  106. width: 250px;
  107. }
  108. }
  109. }
  110. }
  111. }
  112. }
  113. }
  114. .button_box{
  115. margin-left: 45%;
  116. }
  117. }
  118. </style>