wagonLoadEdit.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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="80px" style="margin-left:520px;">
  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="80px" style="margin-left:520px;">
  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. let tmstrainLoadingResult = {
  162. resultId: this.$route.params.resultId,
  163. resultWagonNo: this.form1.resultWagonNo,
  164. resultClass: this.form1.resultClass,
  165. sendStationId: this.sendStationId,
  166. arrivalStationId: this.toTheStationId,
  167. resultLoadingDate: sjTime(this.form1.resultLoadingDate),
  168. batchId: this.form1.batchId,
  169. capacityId: this.form1.capacityId,
  170. resultMaterialNumber: this.form1.resultMaterialNumber,
  171. resultMaterialTheoryweight: this.form1.resultMaterialTheoryweight,
  172. resultRemarks: this.form1.resultRemarks
  173. };
  174. console.log(tmstrainLoadingResult)
  175. if (
  176. tmstrainLoadingResult.resultWagonNo==null||
  177. tmstrainLoadingResult.sendStationId==null||
  178. tmstrainLoadingResult.arrivalStationId==null||
  179. tmstrainLoadingResult.resultLoadingDate==null||
  180. tmstrainLoadingResult.batchId==null
  181. ) this.$message.error("必填项存在空值!");
  182. else
  183. this.axios
  184. .post("/api/v1/tms/upadteTmstrainLoadingResultByResultId",
  185. tmstrainLoadingResult)
  186. .then(() => {
  187. this.$message({
  188. type: "success",
  189. message: "修改成功!",
  190. });
  191. this.$router.go(-1);
  192. });
  193. },
  194. },
  195. };
  196. </script>
  197. <style lang="scss" scoped>
  198. .contractDetails {
  199. .form {
  200. display: flex;
  201. .form_box {
  202. width: 340px;
  203. margin-left: 35%;
  204. margin-top: 30px;
  205. margin-right: 20px;
  206. .el-form {
  207. .preview-group {
  208. .el-form-item {
  209. .el-form-item__label {
  210. display: inline-block;
  211. width: 70px !important;
  212. }
  213. .el-form-item__content {
  214. .el-select {
  215. width: 250px;
  216. }
  217. .el-input {
  218. width: 250px;
  219. }
  220. }
  221. }
  222. }
  223. }
  224. }
  225. }
  226. .button_box {
  227. margin-left: 42%;
  228. margin-top: 55px;
  229. }
  230. }
  231. </style>