shipLocation.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <template>
  2. <!-- 位置作业页面 -->
  3. <div class="homeworkPath">
  4. <div class="top">
  5. <el-date-picker v-model="value" type="date" placeholder="选择日期">
  6. </el-date-picker>
  7. <el-button type="primary" class="btn" @click="onclick">
  8. <i class="el-icon-search"></i>查询
  9. </el-button>
  10. </div>
  11. <el-table :data="selectionList" border highlight-current-row>
  12. <el-table-column type="index" width="50" label="序号" align="center">
  13. </el-table-column>
  14. <el-table-column
  15. v-for="(item, i) in tableTop"
  16. :key="i"
  17. :prop="item.prop"
  18. :label="item.label"
  19. align="center"
  20. :width="item.width"
  21. show-overflow-tooltip
  22. >
  23. <template slot="scope" v-if="item.label !== '船舶位置'">
  24. <span>{{ item.label }}</span>
  25. </template>
  26. <template slot="scope" v-if="item.label !== '位置状态'">
  27. <span>{{ item.label }}</span>
  28. </template>
  29. <template slot="scope" v-if="item.label !== '日期'">
  30. <span>{{ item.label }}</span>
  31. </template>
  32. <!-- 插入输入框 -->
  33. <template slot-scope="scope">
  34. <template v-if="item.slot">
  35. <!-- 船舶位置 -->
  36. <template v-if="item.prop == 'shipLocation'">
  37. <el-input
  38. v-model.number="scope.row.shipLocation"
  39. style="width: 100px;"
  40. @blur="onblur(scope)"
  41. ></el-input>
  42. </template>
  43. <!-- 位置状态 -->
  44. <template v-if="item.prop == 'locationStatus'">
  45. <el-select
  46. v-model.number="scope.row.locationStatus"
  47. placeholder="请选择"
  48. >
  49. <el-option
  50. v-for="(item, i) in options"
  51. :key="i"
  52. :label="item.label"
  53. :value="item.value"
  54. >
  55. </el-option>
  56. </el-select>
  57. </template>
  58. <!-- 日期 -->
  59. <template v-if="item.prop == 'locationRouteTime'">
  60. <el-date-picker
  61. type="date"
  62. v-model.number="scope.row.locationRouteTime"
  63. style="width: 150px;"
  64. :clearable="false"
  65. ></el-date-picker>
  66. </template>
  67. </template>
  68. <template v-else>
  69. <span>{{ scope.row[item.prop] }}</span>
  70. </template>
  71. </template>
  72. </el-table-column>
  73. <el-table-column fixed="right" label="操作" width="60">
  74. <template slot-scope="scope">
  75. <el-button @click="click(scope.row)" type="text" size="small"
  76. >保存</el-button
  77. >
  78. </template>
  79. </el-table-column>
  80. </el-table>
  81. </div>
  82. </template>
  83. <script>
  84. import { sjTime } from "@/utils/sharedJsFile";
  85. export default {
  86. name: "homeworkPath",
  87. data() {
  88. return {
  89. options: [
  90. {
  91. label: "未到闸船舶",
  92. value: "未到闸船舶"
  93. },
  94. {
  95. label: "等闸船舶",
  96. value: "等闸船舶"
  97. },
  98. {
  99. label: "已过闸船舶",
  100. value: "已过闸船舶"
  101. },
  102. {
  103. label: "到港待卸船舶",
  104. value: "到港待卸船舶"
  105. }
  106. ],
  107. value: null,
  108. // 车辆表格表头
  109. tableTop: [
  110. {
  111. prop: "foreignShipName",
  112. label: "外轮船名",
  113. width: "140"
  114. },
  115. {
  116. prop: "materialName",
  117. label: "物资名称",
  118. width: "140"
  119. },
  120. {
  121. prop: "capacityName",
  122. label: "江船船名",
  123. width: "140"
  124. },
  125. {
  126. prop: "locationRouteTime",
  127. label: "离港日期",
  128. width: "200",
  129. slot: true
  130. },
  131. {
  132. prop: "startPortName",
  133. label: "起运港",
  134. width: "140"
  135. },
  136. {
  137. prop: "shipLocation",
  138. label: "船舶位置",
  139. width: "130",
  140. slot: true
  141. },
  142. {
  143. prop: "locationStatus",
  144. label: "位置状态",
  145. width: "180",
  146. slot: true
  147. },
  148. {
  149. prop: "arrivePortName",
  150. label: "到达港",
  151. width: "140"
  152. },
  153. {
  154. prop: "planWeight",
  155. label: "计划吨",
  156. width: "100"
  157. },
  158. {
  159. prop: "realWeight",
  160. label: "实际吨",
  161. width: "100"
  162. },
  163. {
  164. prop: "locationMemo",
  165. label: "备注",
  166. width: "140"
  167. }
  168. ],
  169. selectionList: []
  170. };
  171. },
  172. created() {
  173. this.initialization();
  174. },
  175. methods: {
  176. onblur(scope) {
  177. // console.log("我是交了");
  178. // console.log(scope);
  179. this.axios
  180. .post(
  181. "/api/v1/tms/getShipLocationStatus?shipLocation=" +
  182. scope.row.shipLocation
  183. )
  184. .then(res => {
  185. // console.log(res.data.data);
  186. scope.row.locationStatus = res.data.data.locationStatus;
  187. });
  188. },
  189. initialization() {
  190. this.axios.post("/api/v1/tms/getShipLocationList").then(res => {
  191. if (res.data.code == "200") {
  192. this.selectionList = res.data.data;
  193. }
  194. });
  195. },
  196. onclick() {
  197. this.value = sjTime(this.value);
  198. this.axios
  199. .post("/api/v1/tms/getShipLocationList", { dayTime: this.value })
  200. .then(res => {
  201. if (res.data.code == "200") {
  202. this.selectionList = res.data.data;
  203. }
  204. });
  205. },
  206. click(row) {
  207. this.axios.post("/api/v1/tms/updateShipLocation", row).then(res => {
  208. if (res.data.code == "200") {
  209. this.$message({
  210. type: "success",
  211. message: "保存成功!"
  212. });
  213. this.initialization();
  214. }
  215. });
  216. }
  217. }
  218. };
  219. </script>
  220. <style lang="scss">
  221. .homeworkPath {
  222. .top {
  223. padding: 1.25rem 1.875rem;
  224. }
  225. }
  226. </style>