浏览代码

单航次配船页面

lichao 4 年之前
父节点
当前提交
d4b96575a2
共有 1 个文件被更改,包括 62 次插入62 次删除
  1. 62 62
      src/views/kaihe/singleVoyageShip/index.vue

+ 62 - 62
src/views/kaihe/singleVoyageShip/index.vue

@@ -167,7 +167,6 @@
               </el-tooltip>
 
             </el-form-item>
-<!--            <el-form-item label="提单号"><span class="blNo" v-text="props.row.tidan" @click="$refs.blNo.openDialog(props.row.tidan)"></span></el-form-item>-->
           </el-form>
         </slot>
       </el-table-column>
@@ -344,30 +343,21 @@ export default {
     }
   },
   created() {
-    this.getList();
+    // this.getList();
     this.setRowList = this.tableDate;
     this.getRowList = this.tableDate;
     this.vessleRemthod();
     this.voyageRemthods();
-
-    // const data = {
-    //   fVsl: '凯和志诚1',
-    //   fVoy: '02W1',
-    //   fVslid: 3,
-    //   fVoyid: 6,
-    //   fUpdatetime: '2021-08-11 14:08:00',
-    //   updateStatus: '1',
-    // }
-    // cargoStatus(data).then(response => {
-    //   console.log(response)
-    // })
+  },
+  activated() {
+    this.getList();
   },
   methods: {
     async getList() {
       this.loading = false;
       await listSingleVoyageByShip(this.queryParams).then(response => {
+        console.log(response.rows)
         this.singleShipList = response.rows;
-        console.log(this.singleShipList)
         this.singleShipList.forEach((item, index) => {
           let blNo = {
             fCargoPlanning: 0,
@@ -402,80 +392,90 @@ export default {
     //获取船名
     vessleRemthod() {
       getVesselName().then(response => {
-        this.vesselOptions = response.rows
+        this.vesselOptions = response.rows;
       })
     },
     // 获取航次
     voyageRemthods(){
       getVoyageName().then(response=>{
-        this.voyageOptions = response.rows
+        this.voyageOptions = response.rows;
       })
     },
     // 多选框选中数据
     handleSelectionChange(selection) {
-      this.ship = selection
+      this.ship = selection;
       // this.ids = selection.map(item => item.fId)
-      this.single = selection.length!==1
+      this.single = selection.length!==1;
       // this.multiple = !selection.length
     },
     // 离港出运
     departureShipment() {
-      if (this.departure === null) {
-        this.$message({
-          showClose: true,
-          message: '离港时间未选择',
-          type: 'warning'
-        });
-      } else {
-        const data = {
-          fVsl: this.ship[0].vslName,
-          fVoy: this.ship[0].voyNo,
-          fVslid: this.ship[0].fVslid,
-          fVoyid: this.ship[0].fVoyid,
-          fUpdatetime: this.departure,
-          updateStatus: '1',
-        }
-        cargoStatus(data).then(response => {
-          if (response.code === 200) {
+      if (this.ship[0].fArrivalStatus === 0) {
+        if (this.departure === null) {
+          this.$message({
+            showClose: true,
+            message: '离港时间未选择',
+            type: 'warning'
+          });
+        } else {
+          const data = {
+            fVsl: this.ship[0].vslName,
+            fVoy: this.ship[0].voyNo,
+            fVslid: this.ship[0].fVslid,
+            fVoyid: this.ship[0].fVoyid,
+            fUpdatetime: this.departure,
+            updateStatus: '1',
+          }
+          cargoStatus(data).then(response => {
+            this.getList();
             this.$message({
               showClose: true,
               message: '出港操作成功',
               type: 'success'
             });
-          } else {
-            this.$message({
-              showClose: true,
-              message: response.msg,
-              type: 'warning'
-            });
-          }
-        })
+          })
+        }
+      }else {
+        this.$message({
+          showClose: true,
+          message: '该航次已离港或已到港',
+          type: 'warning'
+        });
       }
     },
     // 到港卸船
     unloading() {
-      if (this.arrival === null) {
+      if (this.ship[0].fArrivalStatus === 1) {
+        if (this.arrival === null) {
+          this.$message({
+            showClose: true,
+            message: '到港时间未选择',
+            type: 'warning'
+          });
+        } else {
+          const data = {
+            fVsl: this.ship[0].vslName,
+            fVoy: this.ship[0].voyNo,
+            fVslid: this.ship[0].fVslid,
+            fVoyid: this.ship[0].fVoyid,
+            fUpdatetime: this.arrival,
+            updateStatus: '2',
+          }
+          cargoStatus(data).then(response => {
+            this.getList();
+            this.$message({
+              showClose: true,
+              message: '到港操作成功',
+              type: 'success'
+            });
+          })
+        }
+      } else {
         this.$message({
           showClose: true,
-          message: '到港时间未选择',
+          message: '该航次未离港或已到港',
           type: 'warning'
         });
-      } else {
-        const data = {
-          fVsl: this.ship[0].vslName,
-          fVoy: this.ship[0].voyNo,
-          fVslid: this.ship[0].fVslid,
-          fVoyid: this.ship[0].fVoyid,
-          fUpdatetime: this.arrival,
-          updateStatus: '2',
-        }
-        cargoStatus(data).then(response => {
-          this.$message({
-            showClose: true,
-            message: '到港操作成功',
-            type: 'success'
-          });
-        })
       }
     },
     // 导出清单