浏览代码

更新 字段默认值

wzh 3 年之前
父节点
当前提交
f43c78182d
共有 2 个文件被更改,包括 27 次插入7 次删除
  1. 5 2
      src/views/voyage/voyageDetail.vue
  2. 22 5
      src/views/voyage/voyageList.vue

+ 5 - 2
src/views/voyage/voyageDetail.vue

@@ -913,7 +913,7 @@
         取消航次
       </el-button>
       <el-button
-        v-if="voyage.dischargeEndTime && disabledStatus"
+        v-if="voyage.canComplete && disabledStatus"
         type="primary"
         size="small"
         @click="finishVoyage"
@@ -1627,7 +1627,10 @@ async function addDischarge() {
   if (res.data.status == 0) {
     getDischargeList(1);
     poundBillList.value = [];
-    formInline.value = {};
+    formInline.value = {
+      dischargeTons: 0,
+      dischargePieces: 0,
+    };
   } else {
     console.log(res);
   }

+ 22 - 5
src/views/voyage/voyageList.vue

@@ -126,7 +126,7 @@
         :rules="rules"
         label-position="right"
         label-width="100px"
-        ref="addVoyageForm"
+        ref="voyageFormRef"
         :model="voyageForm"
       >
         <div class="df ffw">
@@ -469,11 +469,12 @@ let voyageForm = ref({
   loadPort: "",
   dischargeProt: "",
   cargo: "",
-  tons: "",
+  tons: 0,
   loadPortId: "",
   dischargeProtId: "",
   shipId: "",
   shipName: "",
+  pieces: 0,
 });
 
 function clear(type) {
@@ -583,10 +584,10 @@ function clear(type) {
     }
   }, 200);
 }
-let addVoyageForm = ref(null);
+let voyageFormRef = ref(null);
 
 async function addVoyage() {
-  addVoyageForm.value.validate(async (valid) => {
+  voyageFormRef.value.validate(async (valid) => {
     if (valid) {
       console.log("提交", voyageForm.value);
       discPorts.value = discPorts.value.filter((item) => {
@@ -712,7 +713,23 @@ let selectDischargeProt = (item, index) => {
 
 function resetAddVoyageForm() {
   voyageAddDialogVisible.value = false;
-  addVoyageForm.value.resetFields();
+  voyageFormRef.value.resetFields();
+  voyageForm.value = {
+    voyageName: "",
+    cargoOwnerId: "",
+    cargoOwnerName: "",
+    startTime: "",
+    endTime: "",
+    loadPort: "",
+    dischargeProt: "",
+    cargo: "",
+    tons: 0,
+    loadPortId: "",
+    dischargeProtId: "",
+    shipId: "",
+    shipName: "",
+    pieces: 0,
+  };
   discPorts.value = [{}];
 }