editCarDriver.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <template>
  2.   <!-- 修改司机信息 -->
  3.   <div id="contractDetails">
  4.     <page-title>编辑</page-title>
  5.     <div class="main">
  6.       <span class="text">司机信息</span>
  7.     </div>
  8.     <div class="contractTitle">
  9.       <div class="form_box">
  10.           <dil-form :formId="340" v-model="form1"></dil-form>
  11.       </div>
  12.     </div>
  13.     <div class="button_box">
  14.       <el-button type="primary" @click="onClickConfirm">确认</el-button>
  15.       <el-button @click="onClickCancel">返回</el-button>
  16.     </div>
  17.   </div>
  18. </template>
  19. <script>
  20. import PageTitle from "@/components/Page/Title";
  21. export default {
  22.   components: { PageTitle },
  23.   data() {
  24.     return {
  25.       form1: {},
  26.     };
  27.   },
  28.   mounted() {
  29.       console.log(this.$route)
  30.     this.information();
  31.   },
  32.   methods: {
  33.     information() {
  34.       //编辑
  35.       this.axios
  36.         .post(
  37.           "/api/v1/rms/getCarDriverById/" +
  38.             this.$route.params.driverId
  39.         )
  40.         .then((res) => {
  41.             console.log(res)
  42.           res.data.data.forEach((e) => {
  43.             this.form1 = e;
  44.             console.log(e);
  45.             console.log(this.form1);
  46.             console.log(this.$route.params.driverId);
  47.           });
  48.         });
  49.     },
  50.     // 返回
  51.     onClickCancel() {
  52.       this.$router.go(-1);
  53.     },
  54.     // 确认
  55.     onClickConfirm() {
  56.       console.log(this.form1)
  57.         let RmsCarDriver = {
  58. driverId:this.form1.driverId,
  59. driverName:this.form1.driverName,
  60. driverSex:this.form1.driverSex,
  61. driverAge:this.form1.driverAge,
  62. driverIdentityCard:this.form1.driverIdentityCard,
  63. driverPhone:this.form1.driverPhone,
  64. transportTypeId:this.form1.transportTypeId,
  65. carrierId:this.form1.carrierId,
  66. driverPermitNo:this.form1.driverPermitNo,
  67. driverLicence:this.form1.driverLicence,
  68. driverLicence:this.form1.driverLicence,
  69. driverLicence:this.form1.driverLicence,
  70. };
  71. if(
  72. RmsCarDriver.driverName==null ||
  73. RmsCarDriver.driverSex==null ||
  74. RmsCarDriver.driverAge==null ||
  75. RmsCarDriver.driverIdentityCard==null ||
  76. RmsCarDriver.driverPhone==null ||
  77. RmsCarDriver.transportTypeId==null ||
  78. RmsCarDriver.carrierId==null
  79. )this.$message.error("存在空值!");
  80.         this.axios
  81.           .post(
  82.             "/api/v1/rms/updateCarDriver",
  83.             RmsCarDriver
  84.           )
  85.           .then((res) => {
  86.             if (res.data.code == "200") {
  87.               this.$router.go(-1);
  88.             }
  89.           });
  90.     },
  91.   },
  92. };
  93. </script>
  94. <style lang='scss' scoped>
  95. .form_box {
  96. width: 100%;
  97. margin-top: 30px;
  98. display: flex;
  99. justify-content: center;
  100. .el-form-item{
  101. display: flex;
  102. justify-content: center;
  103. .el-form-item__label{
  104. display: flex;
  105. align-items: center;
  106. }
  107. .el-form-item__content{
  108. .el-select{
  109. width: 250px;
  110. }
  111. .el-input{
  112. width: 250px;
  113. }
  114. }
  115. }
  116. }
  117. .inputBox{
  118. display: flex;
  119. justify-content: center;
  120. margin-bottom: 30px;
  121. .text{
  122. text-align: right;
  123. display: flex;
  124. align-items: center;
  125. margin-right: 5px;
  126. }
  127. .input{
  128. width: 250px;
  129. }
  130. }
  131. .button_box{
  132. display: flex;
  133. justify-content: center;
  134. .el-button{
  135. width: 80px;
  136. margin-right: 10px;
  137. }
  138. }
  139. </style>