addUnloadShip.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <template>
  2. <!-- 新增卸船作业 -->
  3. <div class="shipTransport">
  4. <page-title>返回</page-title>
  5. <!-- 第一部分 -->
  6. <div class="top">
  7. <el-input placeholder="请输入内容" v-model="input" clearable> </el-input>
  8. <el-button type="primary" class="btn" @click="onclick()">
  9. <i class="el-icon-search"></i>查询
  10. </el-button>
  11. </div>
  12. <dilTable v-bind.sync="option" @radio-change="currentRadioChange">
  13. </dilTable>
  14. <div class="form">
  15. <!-- 第二部分 -->
  16. <div class="form_box">
  17. <dil-form :formId="121" v-model="form"></dil-form>
  18. </div>
  19. </div>
  20. <div class="button_box">
  21. <el-button type="primary" @click="makeSure">新增卸船作业</el-button>
  22. </div>
  23. </div>
  24. </template>
  25. <script>
  26. import PageTitle from "@/components/Page/Title";
  27. import { sjTime } from "@/utils/sharedJsFile";
  28. export default {
  29. components: { PageTitle },
  30. data() {
  31. return {
  32. input: "",
  33. restaurants: [],
  34. state: "",
  35. form: {},
  36. option: {
  37. // 表格请求数据的地址
  38. requestUrl: "/api/v1/tms/getCapacityList?apiId=138",
  39. // 控制显示当选列
  40. selectionType: "radio"
  41. },
  42. unloadMap: {}
  43. };
  44. },
  45. computed: {
  46. a1() {
  47. return this.form.resultEndTime;
  48. }
  49. },
  50. watch: {
  51. a1() {
  52. this.unloadShipMes();
  53. }
  54. },
  55. methods: {
  56. unloadShipMes() {
  57. if (
  58. typeof this.form.resultStartTime == "undefined" ||
  59. this.form.resultStartTime == null ||
  60. this.form.resultStartTime == "null" ||
  61. this.form.resultStartTime == "undefined"
  62. ) {
  63. this.$message.warning("请先填写卸船开始时间!");
  64. this.form.resultEndTime = null;
  65. }
  66. return;
  67. },
  68. currentRadioChange(row) {
  69. this.unloadMap = {};
  70. this.unloadMap = row;
  71. console.log(row);
  72. },
  73. onclick() {
  74. this.option.requestUrl =
  75. "/api/v1/tms/getCapacityList?apiId=138&con=" + this.input;
  76. },
  77. // 新增
  78. makeSure() {
  79. console.log(this.unloadMap);
  80. if (JSON.stringify(this.unloadMap).length == 2) {
  81. this.$message.error("请先选择卸船的船只!");
  82. return;
  83. }
  84. if (
  85. this.form.resultEndTime != null &&
  86. this.form.resultEndTime != "undefined" &&
  87. typeof this.form.resultEndTime != "undefined" &&
  88. this.form.resultEndTime != "null"
  89. ) {
  90. this.unloadShipMes();
  91. }
  92. let resultArrivalDate = null;
  93. let resultStartTime = null;
  94. let resultEndTime = null;
  95. if (
  96. typeof this.form.resultArrivalDate != "undefined" &&
  97. this.form.resultArrivalDate != null
  98. ) {
  99. resultArrivalDate = sjTime(this.form.resultArrivalDate);
  100. }
  101. if (
  102. typeof this.form.resultStartTime != "undefined" &&
  103. this.form.resultStartTime != null
  104. ) {
  105. resultStartTime = sjTime(this.form.resultStartTime);
  106. }
  107. if (
  108. typeof this.form.resultEndTime != "undefined" &&
  109. this.form.resultEndTime != null
  110. ) {
  111. resultEndTime = sjTime(this.form.resultEndTime);
  112. }
  113. let mapVal = {
  114. resultArrivalDate: resultArrivalDate,
  115. resultStartTime: resultStartTime,
  116. resultEndTime: resultEndTime,
  117. resultStatus: this.form.resultStatus
  118. };
  119. this.axios
  120. .post("/api/v1/tms/addUnLoadShip", {
  121. mapVal: mapVal,
  122. unloadMap: this.unloadMap
  123. })
  124. .then(res => {
  125. if (res.data.code == 200) {
  126. this.$message({
  127. type: "success",
  128. message: "新增成功!"
  129. });
  130. // this.$refs.table.refreshData();
  131. this.$router.go(-1);
  132. } else {
  133. this.$message.error("新增失败!");
  134. }
  135. });
  136. },
  137. loadAll() {
  138. return [];
  139. },
  140. handleSelect(item) {
  141. console.log(item);
  142. }
  143. }
  144. };
  145. </script>
  146. <style lang="scss">
  147. .shipTransport {
  148. .form {
  149. display: flex;
  150. .form_box {
  151. width: 320px;
  152. margin-left: 35%;
  153. margin-top: 30px;
  154. margin-right: 20px;
  155. .el-form {
  156. .preview-group {
  157. .el-form-item {
  158. .el-form-item__label {
  159. display: inline-block;
  160. width: 70px !important;
  161. }
  162. .el-form-item__content {
  163. .el-select {
  164. width: 250px;
  165. }
  166. .el-input {
  167. width: 250px;
  168. }
  169. }
  170. }
  171. }
  172. }
  173. }
  174. }
  175. .top {
  176. padding: 1.25rem 0.375rem;
  177. .el-input {
  178. width: 20%;
  179. margin-right: 1.25rem;
  180. }
  181. }
  182. .button_box {
  183. margin-left: 45%;
  184. }
  185. }
  186. </style>