wagonLoadEdit.vue 7.2 KB

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