wagonLoadEdit.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <template>
  2. <!-- 修改车皮装车实绩 -->
  3. <div class="contractDetails">
  4. <page-title>返回</page-title>
  5. <div class="form">
  6. <div class="form_box">
  7. <dil-form :formId="254" v-model="form1"></dil-form>
  8. </div>
  9. </div>
  10. <div class="fromOther">
  11. <el-form :inline="true" class="demo-form-inline" label-width="70px" style="margin-left:35%;">
  12. <el-form-item label="发站:">
  13. <el-autocomplete
  14. class="inline-input"
  15. v-model="sendStation"
  16. :fetch-suggestions="querySearchSendStation"
  17. placeholder="请输入发站名称"
  18. :trigger-on-focus="false"
  19. @select="handleSelectSendStation"
  20. >
  21. <template slot-scope="{ item }">
  22. <div class="name">{{ item.arrivalName }}</div>
  23. </template>
  24. </el-autocomplete>
  25. </el-form-item>
  26. </el-form>
  27. <el-form :inline="true" class="demo-form-inline" label-width="70px" style="margin-left:35%;">
  28. <el-form-item label="到站:">
  29. <el-autocomplete
  30. class="inline-input"
  31. v-model="toTheStation"
  32. :fetch-suggestions="querySearchToTheStation"
  33. placeholder="请输入到站名称"
  34. :trigger-on-focus="false"
  35. @select="handleSelectToTheStation"
  36. >
  37. <template slot-scope="{ item }">
  38. <div class="name">{{ item.arrivalName }}</div>
  39. </template>
  40. </el-autocomplete>
  41. </el-form-item>
  42. </el-form>
  43. </div>
  44. <div class="button_box">
  45. <el-button type="primary" @click="onClickConfirm">确认</el-button>
  46. <el-button @click="onClickCancel">返回</el-button>
  47. </div>
  48. </div>
  49. </template>
  50. <script>
  51. import PageTitle from "@/components/Page/Title";
  52. import { sjTime } from "@/utils/sharedJsFile";
  53. export default {
  54. components: { PageTitle },
  55. data(){
  56. return {
  57. form1: {},
  58. sendStationId:null,
  59. toTheStationId:null,
  60. sendStation:"",
  61. toTheStation:""
  62. }
  63. },
  64. mounted() {
  65. this.information();
  66. },
  67. methods: {
  68. information() {
  69. //编辑车皮装车作业
  70. this.axios
  71. .post("/api/v1/tms/getTmstrainLoadingResultByResultId/" + this.$route.params.resultId)
  72. .then((res) => {
  73. res.data.data.forEach((e) => {
  74. this.form1 = e;
  75. console.log(e)
  76. this.toTheStationId = e.arrivalStationId
  77. this.sendStationId = e.sendStationId
  78. this.sendStation = e.sendName
  79. this.toTheStation = e.arrivalName
  80. });
  81. });
  82. },
  83. handleCheckedCitiesChange(value) {
  84. console.log(value);
  85. },
  86. // 返回
  87. onClickCancel() {
  88. this.$router.go(-1);
  89. },
  90. currentRadioChange(row) {
  91. this.aaaa = row;
  92. },
  93. //发站弹出层
  94. handleSelectSendStation(item) {
  95. this.sendStationId = item.arrivalId;
  96. this.sendStation = item.arrivalName;
  97. },
  98. //以下是发站边输边查搜索
  99. querySearchSendStation(queryString, cb) {
  100. this.axios
  101. .get("/api/v1/uc/getArrivalByLike?index=" + this.sendStation)
  102. .then((res) => {
  103. if (res.data.code == "200") {
  104. var restaurantsSupplier = res.data.data;
  105. console.log(restaurantsSupplier)
  106. var results = queryString
  107. ? restaurantsSupplier.filter(
  108. this.createFilterSendStation(queryString)
  109. )
  110. : restaurantsSupplier;
  111. // 调用 callback 返回建议列表的数据
  112. cb(results);
  113. }
  114. });
  115. },
  116. //发站
  117. createFilterSendStation(queryString) {
  118. return (restaurantsSupplier) => {
  119. return (
  120. restaurantsSupplier.arrivalName
  121. .toLowerCase()
  122. .indexOf(queryString.toLowerCase()) > -1
  123. );
  124. };
  125. },
  126. //到站弹出层
  127. handleSelectToTheStation(item) {
  128. this.toTheStationId = item.arrivalId;
  129. this.toTheStation = item.arrivalName;
  130. },
  131. //以下是到站边输边查搜索
  132. querySearchToTheStation(queryString, cb) {
  133. this.axios
  134. .get("/api/v1/uc/getArrivalByLike?index=" + this.toTheStation)
  135. .then((res) => {
  136. if (res.data.code == "200") {
  137. var restaurantsSupplier = res.data.data;
  138. console.log(restaurantsSupplier)
  139. var results = queryString
  140. ? restaurantsSupplier.filter(
  141. this.createFilterToTheStation(queryString)
  142. )
  143. : restaurantsSupplier;
  144. // 调用 callback 返回建议列表的数据
  145. cb(results);
  146. }
  147. });
  148. },
  149. //到站
  150. createFilterToTheStation(queryString) {
  151. return (restaurantsSupplier) => {
  152. return (
  153. restaurantsSupplier.arrivalName
  154. .toLowerCase()
  155. .indexOf(queryString.toLowerCase()) > -1
  156. );
  157. };
  158. },
  159. // 确认
  160. onClickConfirm() {
  161. console.log(this.form1);
  162. let tmstrainLoadingResult = {
  163. resultId: this.$route.params.resultId,
  164. resultWagonNo: this.form1.resultWagonNo,
  165. purchaseOrderRailPlanId:this.form1.purchaseOrderNo,
  166. sendStationId: this.sendStationId,
  167. arrivalStationId: this.toTheStationId,
  168. resultLoadingDate: sjTime(this.form1.resultLoadingDate),
  169. resultRemarks: this.form1.resultRemarks
  170. };
  171. console.log(tmstrainLoadingResult)
  172. if (
  173. tmstrainLoadingResult.resultWagonNo==null||
  174. tmstrainLoadingResult.sendStationId==null||
  175. tmstrainLoadingResult.arrivalStationId==null||
  176. tmstrainLoadingResult.resultLoadingDate==null||
  177. tmstrainLoadingResult.purchaseOrderRailPlanId==null
  178. ) this.$message.error("必填项存在空值!");
  179. else{
  180. this.axios
  181. .post("/api/v1/tms/upadteTmstrainLoadingResultByResultId",
  182. tmstrainLoadingResult)
  183. .then(() => {
  184. this.$message({
  185. type: "success",
  186. message: "修改成功!",
  187. });
  188. this.$router.go(-1);
  189. });
  190. }
  191. },
  192. },
  193. };
  194. </script>
  195. <style lang="scss" scoped>
  196. .contractDetails {
  197. .form {
  198. display: flex;
  199. .form_box {
  200. width: 340px;
  201. margin-left: 35%;
  202. margin-top: 30px;
  203. margin-right: 20px;
  204. .el-form {
  205. .preview-group {
  206. .el-form-item {
  207. .el-form-item__label {
  208. display: inline-block;
  209. width: 70px !important;
  210. }
  211. .el-form-item__content {
  212. .el-select {
  213. width: 250px;
  214. }
  215. .el-input {
  216. width: 250px;
  217. }
  218. }
  219. }
  220. }
  221. }
  222. }
  223. }
  224. .button_box {
  225. margin-left: 42%;
  226. margin-top: 55px;
  227. width: 300px;
  228. }
  229. }
  230. </style>