updatePlan.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. //修改计划
  2. <template>
  3. <div id="endMaintenance">
  4. <page-title>修改计划</page-title>
  5. <div class="form-box">
  6. <el-form class="demo-form-inline" label-width="80px" label-position="left">
  7. <el-form-item label="承运商">
  8. <el-autocomplete
  9. class="inline-input"
  10. v-model="state2"
  11. :fetch-suggestions="querySearch"
  12. placeholder="请输入承运商名称"
  13. :trigger-on-focus="false"
  14. @select="handleSelect"
  15. >
  16. <template slot-scope="{ item }">
  17. <div class="name">{{ item.value }}</div>
  18. </template>
  19. </el-autocomplete>
  20. </el-form-item>
  21. <el-form class="demo-form-inline" label-width="80px" label-position="left">
  22. <el-form-item label="车数">
  23. <el-input v-model="planTruckNumber" placeholder="必填" class="input"></el-input>
  24. </el-form-item>
  25. </el-form>
  26. </el-form>
  27. </div>
  28. <template>
  29. <div>
  30. <dilTable v-bind.sync="first" >
  31. </dilTable>
  32. </div>
  33. </template>
  34. <div class="button-box">
  35. <el-button type="primary" @click="makeSure">确认修改</el-button>
  36. <el-button type="primary" @click="cancel">返回</el-button>
  37. </div>
  38. </div>
  39. </template>
  40. <script>
  41. import PageTitle from "@/components/Page/Title";
  42. import { sjTime } from "@/utils/sharedJsFile";
  43. export default {
  44. components: { PageTitle },
  45. data() {
  46. return {
  47. form: {},
  48. restaurants: [],
  49. state2:null,
  50. planTruckNumber:null,
  51. carrierId:null,
  52. numberValidateForm: {
  53. planTruckNumber: null,
  54. },
  55. first:{
  56. requestUrl:"/api/v1/ams/getTruckPlanList?apiId=257&planStatus=0&planId=" + this.$route.params.planId,
  57. }
  58. };
  59. },
  60. mounted(){
  61. this.information();
  62. },
  63. methods: {
  64. handleSelect(item){
  65. this.carrierId = item.carrierId
  66. this.state2 = item.carrierName
  67. },
  68. //搜索
  69. querySearch(queryString, cb) {
  70. this.axios.post('/api/v1/uc/getCarrierMesByLike?index='+this.state2).then((res)=>{
  71. if(res.data.code == "200"){
  72. var restaurants = res.data.data
  73. var results = queryString ? restaurants.filter(this.createFilter(queryString)) :restaurants;
  74. // 调用 callback 返回建议列表的数据
  75. console.log(results,"results");
  76. cb(results);
  77. }
  78. })
  79. },
  80. createFilter(queryString) {
  81. return (restaurants) => {
  82. return (restaurants.value.toLowerCase().indexOf(queryString.toLowerCase()) > -1);
  83. };
  84. },
  85. // 修改
  86. makeSure() {
  87. if(this.carrierId == null){
  88. this.$alert('请输入承运商!')
  89. return
  90. }else if(this.planTruckNumber == null){
  91. this.$alert('请输入车数!')
  92. return
  93. }
  94. let plan = {
  95. planId : this.$route.params.planId,
  96. planTruckNumber: this.planTruckNumber,
  97. carrierId: this.carrierId
  98. };
  99. this.axios
  100. .post(
  101. "/api/v1/ams/updateTruckPlan",
  102. plan
  103. )
  104. .then((res) => {
  105. console.log(res)
  106. if (res.data.code == 200) {
  107. this.$message({
  108. type: "success",
  109. message: "修改成功!",
  110. });
  111. this.$router.go(-1);
  112. } else {
  113. this.$message.error("修改失败!");
  114. }
  115. });
  116. },
  117. // 返回
  118. cancel() {
  119. this.$router.go(-1);
  120. },
  121. },
  122. };
  123. </script>
  124. <style lang="scss">
  125. .form-box{
  126. display: inline-block;
  127. margin-left: 38%;
  128. .el-input{
  129. width:288px
  130. }
  131. .input{
  132. margin-left: -10px;
  133. }
  134. .el-form{
  135. padding: 10px;
  136. }
  137. }
  138. .button-box
  139. {
  140. margin-left: 45%;
  141. }
  142. </style>