shipLocation.vue 7.1 KB

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