editWagonLoadEmergency.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <template>
  2. <!-- 修改车皮装车实绩 -->
  3. <div class="addWagonLoad">
  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. created() {
  65. this.form1 = {
  66. arrivalStationId: 1,
  67. };
  68. },
  69. mounted() {
  70. this.information();
  71. },
  72. methods: {
  73. information() {
  74. console.log("add", this.$route.params);
  75. //编辑车皮装车作业
  76. this.axios
  77. .post(
  78. "/api/v1/tms/getTmstrainLoadingResultByResultId/" +
  79. this.$route.params.unloadingId
  80. )
  81. .then((res) => {
  82. res.data.data.forEach((e) => {
  83. this.form1 = e;
  84. console.log(e)
  85. this.toTheStationId = e.arrivalStationId
  86. this.sendStationId = e.sendStationId
  87. this.sendStation = e.sendName
  88. this.toTheStation = e.arrivalName
  89. });
  90. });
  91. },
  92. handleCheckedCitiesChange(value) {
  93. console.log(value);
  94. },
  95. // 返回
  96. onClickCancel() {
  97. this.$router.go(-1);
  98. },
  99. currentRadioChange(row) {
  100. this.aaaa = row;
  101. },
  102. //发站弹出层
  103. handleSelectSendStation(item) {
  104. this.sendStationId = item.arrivalId;
  105. this.sendStation = item.arrivalName;
  106. },
  107. //以下是发站边输边查搜索
  108. querySearchSendStation(queryString, cb) {
  109. this.axios
  110. .get("/api/v1/uc/getArrivalByLike?index=" + this.sendStation)
  111. .then((res) => {
  112. if (res.data.code == "200") {
  113. var restaurantsSupplier = res.data.data;
  114. console.log(restaurantsSupplier)
  115. var results = queryString
  116. ? restaurantsSupplier.filter(
  117. this.createFilterSendStation(queryString)
  118. )
  119. : restaurantsSupplier;
  120. // 调用 callback 返回建议列表的数据
  121. cb(results);
  122. }
  123. });
  124. },
  125. //发站
  126. createFilterSendStation(queryString) {
  127. return (restaurantsSupplier) => {
  128. return (
  129. restaurantsSupplier.arrivalName
  130. .toLowerCase()
  131. .indexOf(queryString.toLowerCase()) > -1
  132. );
  133. };
  134. },
  135. //到站弹出层
  136. handleSelectToTheStation(item) {
  137. this.toTheStationId = item.arrivalId;
  138. this.toTheStation = item.arrivalName;
  139. },
  140. //以下是到站边输边查搜索
  141. querySearchToTheStation(queryString, cb) {
  142. this.axios
  143. .get("/api/v1/uc/getArrivalByLike?index=" + this.toTheStation)
  144. .then((res) => {
  145. if (res.data.code == "200") {
  146. var restaurantsSupplier = res.data.data;
  147. console.log(restaurantsSupplier)
  148. var results = queryString
  149. ? restaurantsSupplier.filter(
  150. this.createFilterToTheStation(queryString)
  151. )
  152. : restaurantsSupplier;
  153. // 调用 callback 返回建议列表的数据
  154. cb(results);
  155. }
  156. });
  157. },
  158. //到站
  159. createFilterToTheStation(queryString) {
  160. return (restaurantsSupplier) => {
  161. return (
  162. restaurantsSupplier.arrivalName
  163. .toLowerCase()
  164. .indexOf(queryString.toLowerCase()) > -1
  165. );
  166. };
  167. },
  168. // 确认
  169. onClickConfirm() {
  170. let tmstrainLoadingResult = {
  171. resultId: this.$route.params.unloadingId,
  172. resultWagonNo: this.form1.resultWagonNo,
  173. resultBillableTonnage: this.form1.resultBillableTonnage,
  174. resultClass: this.form1.resultClass,
  175. sendStationId: this.sendStationId,
  176. arrivalStationId: this.toTheStationId,
  177. resultLoadingDate: sjTime(this.form1.resultLoadingDate),
  178. batchId: this.form1.batchId,
  179. capacityId: this.form1.capacityId,
  180. resultMaterialNumber: this.form1.resultMaterialNumber,
  181. resultMaterialTheoryweight: this.form1.resultMaterialTheoryweight,
  182. resultRemarks: this.form1.resultRemarks,
  183. };
  184. console.log(tmstrainLoadingResult)
  185. if (
  186. tmstrainLoadingResult.resultWagonNo == null ||
  187. tmstrainLoadingResult.sendStationId == null ||
  188. tmstrainLoadingResult.arrivalStationId == null ||
  189. tmstrainLoadingResult.resultLoadingDate == null ||
  190. tmstrainLoadingResult.batchId == null
  191. )
  192. this.$message.error("必填项存在空值!");
  193. else
  194. this.axios
  195. .post(
  196. "/api/v1/tms/upadteTmstrainLoadingResultByResultId",
  197. tmstrainLoadingResult
  198. )
  199. .then(() => {
  200. this.$message({
  201. type: "success",
  202. message: "修改成功!",
  203. });
  204. this.$router.go(-1);
  205. });
  206. },
  207. },
  208. };
  209. </script>
  210. <style lang="scss" scoped>
  211. .addWagonLoad {
  212. color: #606266;
  213. font-size: 0.675rem;
  214. font-weight: 500;
  215. .form {
  216. display: flex;
  217. .form_box {
  218. width: 340px;
  219. margin-left: 37%;
  220. margin-right: 20px;
  221. .el-form {
  222. .preview-group {
  223. .el-form-item {
  224. .el-form-item__label {
  225. display: inline-block;
  226. width: 70px !important;
  227. }
  228. .el-form-item__content {
  229. .el-select {
  230. width: 250px;
  231. }
  232. .el-input {
  233. width: 250px;
  234. }
  235. .el-textarea {
  236. .el-textarea__inner {
  237. width: 220px;
  238. margin-top: 0.03rem;
  239. }
  240. }
  241. }
  242. }
  243. }
  244. }
  245. }
  246. }
  247. .button_box {
  248. display: flex;
  249. justify-content: center;
  250. padding-top: 30px;
  251. margin-left: 3.5%;
  252. }
  253. }
  254. </style>