editOutBoundWagon.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. <template>
  2. <!-- 修改车皮出库实绩 -->
  3. <div class="editOutBoundWagon">
  4. <page-title>返回</page-title>
  5. <div class="form">
  6. <div class="form_box">
  7. <el-form :inline="true" class="demo-form-inline">
  8. <div class="preview-group">
  9. <el-form-item label="车皮">
  10. <el-input v-model="form.wagonNo"></el-input>
  11. </el-form-item>
  12. <el-form-item label="采购订单号">
  13. <el-input v-model="form.purchaseOrderNo" disabled></el-input>
  14. </el-form-item>
  15. <el-form-item label="是否拼装">
  16. <el-switch v-model="isAssembly"> </el-switch>
  17. </el-form-item>
  18. <el-form-item v-show="isAssembly" label="标重">
  19. <el-input type="number" v-model="form.tonnage"></el-input>
  20. </el-form-item>
  21. <el-form-item label="发站">
  22. <el-autocomplete
  23. class="inline-input"
  24. v-model="sendStation"
  25. :fetch-suggestions="querySearchSendStation"
  26. placeholder="请输入发站名称"
  27. disabled
  28. :trigger-on-focus="false"
  29. @select="handleSelectSendStation"
  30. >
  31. <template slot-scope="{ item }">
  32. <div class="name">{{ item.arrivalName }}</div>
  33. </template>
  34. </el-autocomplete>
  35. </el-form-item>
  36. <el-form-item label="到站">
  37. <el-autocomplete
  38. class="inline-input"
  39. v-model="toTheStation"
  40. disabled
  41. :fetch-suggestions="querySearchToTheStation"
  42. placeholder="请输入到站名称"
  43. :trigger-on-focus="false"
  44. @select="handleSelectToTheStation"
  45. >
  46. <template slot-scope="{ item }">
  47. <div class="name">{{ item.arrivalName }}</div>
  48. </template>
  49. </el-autocomplete>
  50. </el-form-item>
  51. <el-form-item label="备注">
  52. <el-input type="textarea" v-model="form.resultMarks"></el-input>
  53. </el-form-item>
  54. </div>
  55. </el-form>
  56. </div>
  57. </div>
  58. <!-- 确定和取消 -->
  59. <div class="button_box">
  60. <el-button @click="cancel">返回</el-button>
  61. <el-button type="primary" @click="makeSure">确认</el-button>
  62. </div>
  63. </div>
  64. </template>
  65. <script>
  66. import PageTitle from "@/components/Page/Title";
  67. import { sjTime, isNumber } from "@/utils/sharedJsFile";
  68. import { getCookie } from "@/utils/util.js";
  69. export default {
  70. components: { PageTitle },
  71. data() {
  72. return {
  73. form: {},
  74. wagonNo: null,
  75. tonnage: null,
  76. isAssembly: false,
  77. sendStationId: 4, //发站id和到站id都写死了,并且赋了港口名,如果数据库id变化,要注意
  78. toTheStationId: 1,
  79. sendStation: "万州港",
  80. toTheStation: "老区轨道衡",
  81. };
  82. },
  83. mounted() {
  84. this.information();
  85. },
  86. methods: {
  87. information() {
  88. console.log("resultId" + this.$route.params.resultId);
  89. //编辑车皮装车作业
  90. this.axios
  91. .post(
  92. "/api/v1/tms/getWareHouseOutresult/" + this.$route.params.resultId
  93. )
  94. .then((res) => {
  95. res.data.data.forEach((e) => {
  96. this.form = e;
  97. this.wagonNo = e.wagonNo;
  98. this.tonnage = e.tonnage;
  99. console.log(e);
  100. });
  101. });
  102. },
  103. handleCheckedCitiesChange(value) {
  104. console.log(value);
  105. },
  106. // 返回
  107. cancel() {
  108. this.$router.go(-1);
  109. },
  110. currentRadioChange(row) {
  111. this.aaaa = row;
  112. },
  113. //发站弹出层
  114. handleSelectSendStation(item) {
  115. this.sendStationId = item.arrivalId;
  116. this.sendStation = item.arrivalName;
  117. },
  118. //以下是发站边输边查搜索
  119. querySearchSendStation(queryString, cb) {
  120. this.axios
  121. .get("/api/v1/uc/getArrivalByLike?index=" + this.sendStation)
  122. .then((res) => {
  123. if (res.data.code == "200") {
  124. var restaurantsSupplier = res.data.data;
  125. console.log(restaurantsSupplier);
  126. var results = queryString
  127. ? restaurantsSupplier.filter(
  128. this.createFilterSendStation(queryString)
  129. )
  130. : restaurantsSupplier;
  131. // 调用 callback 返回建议列表的数据
  132. cb(results);
  133. }
  134. });
  135. },
  136. //发站
  137. createFilterSendStation(queryString) {
  138. return (restaurantsSupplier) => {
  139. return (
  140. restaurantsSupplier.arrivalName
  141. .toLowerCase()
  142. .indexOf(queryString.toLowerCase()) > -1
  143. );
  144. };
  145. },
  146. //到站弹出层
  147. handleSelectToTheStation(item) {
  148. this.toTheStationId = item.arrivalId;
  149. this.toTheStation = item.arrivalName;
  150. },
  151. //以下是到站边输边查搜索
  152. querySearchToTheStation(queryString, cb) {
  153. this.axios
  154. .get("/api/v1/uc/getArrivalByLike?index=" + this.toTheStation)
  155. .then((res) => {
  156. if (res.data.code == "200") {
  157. var restaurantsSupplier = res.data.data;
  158. console.log(restaurantsSupplier);
  159. var results = queryString
  160. ? restaurantsSupplier.filter(
  161. this.createFilterToTheStation(queryString)
  162. )
  163. : restaurantsSupplier;
  164. // 调用 callback 返回建议列表的数据
  165. cb(results);
  166. }
  167. });
  168. },
  169. //到站
  170. createFilterToTheStation(queryString) {
  171. return (restaurantsSupplier) => {
  172. return (
  173. restaurantsSupplier.arrivalName
  174. .toLowerCase()
  175. .indexOf(queryString.toLowerCase()) > -1
  176. );
  177. };
  178. },
  179. // 确认
  180. makeSure() {
  181. let map = {
  182. loadingTempId: this.$route.params.resultId,
  183. OutResultId: this.form.OutResultId,
  184. isAssembly: this.isAssembly,
  185. wagonNo: this.wagonNo,
  186. wagonNew: this.form.wagonNo,
  187. batchId: this.form.batchId,
  188. portId: this.form.portId,
  189. wagonWeight: this.tonnage,
  190. wagonWeightNew: this.form.tonnage,
  191. resultRemarks: this.form.resultRemarks,
  192. purchaseOrderNo: this.form.purchaseOrderNo,
  193. userId: getCookie("userId"),
  194. resultType: 1,
  195. };
  196. console.log(map);
  197. if (
  198. map.loadingTempId == null ||
  199. map.wagonNew == null ||
  200. map.purchaseOrderNo == null ||
  201. (map.isAssembly && map.wagonWeightNew == null)
  202. )
  203. this.$message.error("必填项存在空值!");
  204. else
  205. this.axios
  206. .post("/api/v1/tms/updateWarehouseResult", map)
  207. .then((res) => {
  208. if (res.data.code == "200") {
  209. this.$message({
  210. type: "success",
  211. message: "修改成功!",
  212. });
  213. this.$router.go(-1);
  214. } else {
  215. this.$message({
  216. type: "error",
  217. message: res.data.data,
  218. });
  219. }
  220. });
  221. },
  222. },
  223. };
  224. </script>
  225. <style lang="scss">
  226. .editOutBoundWagon {
  227. .form {
  228. display: flex;
  229. .form_box {
  230. width: 340px;
  231. margin-left: 35%;
  232. margin-top: 30px;
  233. margin-right: 20px;
  234. .el-form {
  235. .preview-group {
  236. .el-form-item {
  237. .el-form-item__label {
  238. display: inline-block;
  239. width: 70px !important;
  240. }
  241. .el-form-item__content {
  242. .el-select {
  243. width: 250px;
  244. }
  245. .el-input {
  246. width: 250px;
  247. }
  248. .el-textarea {
  249. .el-textarea__inner {
  250. width: 220px;
  251. margin-left: 65px;
  252. margin-top: 0.03rem;
  253. }
  254. }
  255. }
  256. }
  257. }
  258. }
  259. }
  260. }
  261. .button_box {
  262. margin-left: 42%;
  263. margin-top: 55px;
  264. }
  265. .fromOther .el-input__inner {
  266. width: 250px;
  267. }
  268. }
  269. </style>