Przeglądaj źródła

页面调整,暂存取消判断

tong 4 lat temu
rodzic
commit
7bedce3ef4

+ 10 - 5
src/views/warehouseBusiness/goodsTransfer/index.vue

@@ -235,7 +235,7 @@
       append-to-body
     >
       <el-form
-        style="height: 570px"
+        style="height: 300px"
         ref="form"
         :model="form"
         :rules="rules"
@@ -260,7 +260,6 @@
                 ></el-option>
               </el-select>
             </el-form-item>
-            <el-button :disabled="browseStatus" @click.prevent="addRelevant()">显示库存</el-button>
           </el-col>
           <el-col :span="8">
             <el-form-item label="新货权方" prop="fTocorpid">
@@ -309,8 +308,6 @@
               </el-select>
             </el-form-item>
           </el-col>
-        </el-row>
-        <el-row>
           <el-col :span="8">
             <el-form-item label="货转日期" prop="fBsdate">
               <el-date-picker
@@ -335,6 +332,8 @@
               </el-date-picker>
             </el-form-item>
           </el-col>
+        </el-row>
+        <el-row>
           <el-col :span="8">
             <el-form-item label="结算方式" prop="fStltypeid">
               <el-select
@@ -419,6 +418,8 @@
               </el-date-picker>
             </el-form-item>
           </el-col>
+        </el-row>
+        <el-row>
           <el-col :span="8">
             <el-form-item label="仓库" prop="fWarehouseid">
               <el-select
@@ -443,6 +444,7 @@
       </el-form>
       <div class="dialogTableTitle flex a-center jlr">
         <h2>库存明细</h2>
+        <el-button :disabled="browseStatus" @click.prevent="addRelevant()">显示库存</el-button>
       </div>
       <el-table
         :data="dataList"
@@ -2030,7 +2032,7 @@ export default {
       this.warehouseCrList = [];
       this.warehouseDrList = [];
       this.relevantAttachments = [];
-      this.title = "入库单";
+      this.title = "货权转移";
     },
     /** 修改按钮操作 */
     handleUpdate(row, status) {
@@ -2275,10 +2277,13 @@ export default {
     },
     // 变更计价单位
     changeFeeUnit (row) {
+      console.log(row)
+      console.log(this.form.fCntqty)
       if (!row.fFeeUnitid) {
         return false
       }
       if (row.fFeeUnitid === '0') {
+        console.log(this.form.fCntqty)
         this.$set(row, 'fQty', this.form.fCntqty)
       } else if (row.fFeeUnitid === '1') {
         this.$set(row, 'fQty', this.form.fGrossweight)

+ 280 - 250
src/views/warehouseBusiness/inStock/index.vue

@@ -238,13 +238,7 @@
       width="80%"
       append-to-body
     >
-      <el-form
-        style="height: 570px"
-        ref="form"
-        :model="form"
-        :rules="rules"
-        label-width="120px"
-      >
+      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
         <el-row>
           <el-col :span="8">
             <el-form-item label="货权方" prop="fCorpid">
@@ -461,169 +455,179 @@
             />
           </el-form-item>
         </el-row>
-        <el-row style="margin-top: 30px">
-          <el-col :span="8">
-            <el-form-item label="仓库联系人" prop="fContacts">
-              <el-input
-                v-model="form.fContacts"
-                style="width: 250px"
-                :disabled="browseStatus"
-                placeholder="仓库联系人"
-              />
-            </el-form-item>
-          </el-col>
-          <el-col :span="8">
-            <el-form-item label="仓库电话" prop="fTel">
-              <el-input
-                v-model="form.fTel"
-                :disabled="browseStatus"
-                style="width: 250px"
-                placeholder="请输仓库入电话"
-              />
-            </el-form-item>
-          </el-col>
-          <el-col :span="8">
-            <el-form-item label="船名航次" prop="fVslvoy">
-              <el-input
-                v-model="form.fVslvoy"
-                style="width: 250px"
-                :disabled="browseStatus"
-                placeholder="船名航次"
-              />
-            </el-form-item>
-          </el-col>
-        </el-row>
-        <el-row>
-          <el-col :span="8">
-            <el-form-item label="到港日期" prop="fEta">
-              <el-date-picker
-                v-model="form.fEta"
-                style="width: 250px"
-                type="date"
-                :disabled="browseStatus"
-                value-format="timestamp"
-                placeholder="到港日期"
-              >
-              </el-date-picker>
-            </el-form-item>
-          </el-col>
-          <el-col :span="8">
-            <el-form-item label="报关单号" prop="fCustomno">
-              <el-input
-                v-model="form.fCustomno"
-                style="width: 250px"
-                :disabled="browseStatus"
-                laceholder="报关单号"
-              />
-            </el-form-item>
-          </el-col>
+        <!--点击展开-->
+        <el-button
+          @click="
+            detailsHidden ? (detailsHidden = false) : (detailsHidden = true)
+          "
+          >展开</el-button
+        >
+        <div v-if="detailsHidden">
+          <el-row style="margin-top: 30px">
+            <el-col :span="8">
+              <el-form-item label="仓库联系人" prop="fContacts">
+                <el-input
+                  v-model="form.fContacts"
+                  style="width: 250px"
+                  :disabled="browseStatus"
+                  placeholder="仓库联系人"
+                />
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="仓库电话" prop="fTel">
+                <el-input
+                  v-model="form.fTel"
+                  :disabled="browseStatus"
+                  style="width: 250px"
+                  placeholder="请输仓库入电话"
+                />
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="船名航次" prop="fVslvoy">
+                <el-input
+                  v-model="form.fVslvoy"
+                  style="width: 250px"
+                  :disabled="browseStatus"
+                  placeholder="船名航次"
+                />
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row>
+            <el-col :span="8">
+              <el-form-item label="到港日期" prop="fEta">
+                <el-date-picker
+                  v-model="form.fEta"
+                  style="width: 250px"
+                  type="date"
+                  :disabled="browseStatus"
+                  value-format="timestamp"
+                  placeholder="到港日期"
+                >
+                </el-date-picker>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="报关单号" prop="fCustomno">
+                <el-input
+                  v-model="form.fCustomno"
+                  style="width: 250px"
+                  :disabled="browseStatus"
+                  laceholder="报关单号"
+                />
+              </el-form-item>
+            </el-col>
 
-          <el-col :span="8">
-            <el-form-item label="经营单位" prop="fSbu">
-              <el-select
-                v-model="form.fSbu"
-                filterable
-                remote
-                :disabled="browseStatus"
-                :remote-method="fSbuRemoteMethod"
-                style="width: 250px"
-                placeholder="请选择经营单位"
-              >
-                <el-option
-                  v-for="(dict, index) in fSbuOptions"
-                  :key="index.fId"
-                  :label="dict.fName"
-                  :value="dict.fId"
-                ></el-option>
-              </el-select>
-            </el-form-item>
-          </el-col>
-        </el-row>
-        <el-row>
-          <el-col :span="8">
-            <el-form-item label="单据编号" prop="fBillno">
-              <el-input
-                v-model="form.fBillno"
-                disabled
-                style="width: 250px"
-                placeholder="单据编号"
-              />
-            </el-form-item>
-          </el-col>
-          <el-col :span="8">
-            <el-form-item label="贸易方式" prop="fTrademodeid">
-              <el-select
-                v-model="form.fTrademodeid"
-                placeholder="请选择贸易方式"
-                :disabled="browseStatus"
-                clearable
-                style="width: 250px"
-              >
-                <el-option
-                  v-for="(dict, index) in fTrademodeidOptions"
-                  :key="index.dictValue"
-                  :label="dict.dictLabel"
-                  :value="dict.dictValue"
+            <el-col :span="8">
+              <el-form-item label="经营单位" prop="fSbu">
+                <el-select
+                  v-model="form.fSbu"
+                  filterable
+                  remote
+                  :disabled="browseStatus"
+                  :remote-method="fSbuRemoteMethod"
+                  style="width: 250px"
+                  placeholder="请选择经营单位"
+                >
+                  <el-option
+                    v-for="(dict, index) in fSbuOptions"
+                    :key="index.fId"
+                    :label="dict.fName"
+                    :value="dict.fId"
+                  ></el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row>
+            <el-col :span="8">
+              <el-form-item label="单据编号" prop="fBillno">
+                <el-input
+                  v-model="form.fBillno"
+                  disabled
+                  style="width: 250px"
+                  placeholder="单据编号"
                 />
-              </el-select>
-            </el-form-item>
-          </el-col>
-          <el-col :span="8">
-            <el-form-item label="制单人" prop="createBy">
-              <el-input
-                disabled
-                v-model="form.createBy"
-                style="width: 250px"
-                placeholder="制单人"
-              />
-            </el-form-item>
-          </el-col>
-        </el-row>
-        <el-row>
-          <el-col :span="8">
-            <el-form-item label="制单部门" prop="fDeptid">
-              <el-select
-                v-model="form.fDeptid"
-                filterable
-                disabled
-                style="width: 250px"
-                remote
-              >
-                <el-option
-                  v-for="(dict, index) in deptOptions"
-                  :key="index.deptId"
-                  :label="dict.deptName"
-                  :value="dict.deptId"
-                ></el-option>
-              </el-select>
-            </el-form-item>
-          </el-col>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="贸易方式" prop="fTrademodeid">
+                <el-select
+                  v-model="form.fTrademodeid"
+                  placeholder="请选择贸易方式"
+                  :disabled="browseStatus"
+                  clearable
+                  style="width: 250px"
+                >
+                  <el-option
+                    v-for="(dict, index) in fTrademodeidOptions"
+                    :key="index.dictValue"
+                    :label="dict.dictLabel"
+                    :value="dict.dictValue"
+                  />
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="制单人" prop="createBy">
+                <el-input
+                  disabled
+                  v-model="form.createBy"
+                  style="width: 250px"
+                  placeholder="制单人"
+                />
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row>
+            <el-col :span="8">
+              <el-form-item label="制单部门" prop="fDeptid">
+                <el-select
+                  v-model="form.fDeptid"
+                  filterable
+                  disabled
+                  style="width: 250px"
+                  remote
+                >
+                  <el-option
+                    v-for="(dict, index) in deptOptions"
+                    :key="index.deptId"
+                    :label="dict.deptName"
+                    :value="dict.deptId"
+                  ></el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
 
-          <el-col :span="8">
-            <el-form-item disabled label="制单日期" prop="fbilldate">
-              <el-date-picker
-                v-model="form.createTime"
-                size="large"
-                type="date"
-                disabled
-                value-format="timestamp"
-                placeholder="制单日期"
-              >
-              </el-date-picker>
-            </el-form-item>
-          </el-col>
-          <el-col :span="8">
-            <el-form-item label="唛头" prop="fbarks">
-              <el-input
-                v-model="form.fMarks"
-                style="width: 250px"
-                :disabled="browseStatus"
-                placeholder="唛头"
-              />
-            </el-form-item>
-          </el-col>
-        </el-row>
+            <el-col :span="8">
+              <el-form-item disabled label="制单日期" prop="fbilldate">
+                <el-date-picker
+                  v-model="form.createTime"
+                  size="large"
+                  type="date"
+                  disabled
+                  value-format="timestamp"
+                  placeholder="制单日期"
+                >
+                </el-date-picker>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="唛头" prop="fbarks">
+                <el-input
+                  v-model="form.fMarks"
+                  style="width: 250px"
+                  :disabled="browseStatus"
+                  placeholder="唛头"
+                />
+              </el-form-item>
+            </el-col>
+          </el-row>
+        </div>
       </el-form>
+
       <div class="dialogTableTitle flex a-center jlr">
         <h2>库存明细</h2>
         <el-button :disabled="browseStatus" @click.prevent="addRelevant()"
@@ -1067,7 +1071,7 @@
         border
         stripe
         show-summary
-        :summary-method="getwarehouseDrList"
+        :summary-method="warehouseDrSummaries"
       >
         <el-table-column label="序号" type="index" width="80">
         </el-table-column>
@@ -1132,7 +1136,7 @@
             <el-select
               v-model="scope.row.fFeeUnitid"
               placeholder="请选择计价单位"
-              @change="changefFeeunitid"
+              @change="changeFeeUnit(scope.row)"
               clearable
               :disabled="browseStatus"
             >
@@ -1291,7 +1295,7 @@
         border
         stripe
         show-summary
-        :summary-method="getwarehouseCrList"
+        :summary-method="warehouseDrSummaries"
       >
         <el-table-column label="序号" type="index" width="80">
         </el-table-column>
@@ -1357,7 +1361,7 @@
               v-model="scope.row.fFeeUnitid"
               filterable
               remote
-              @change="changefFeeunitids"
+              @change="changeFeeUnit(scope.row)"
               :disabled="browseStatus"
               :remote-method="corpsRemoteMethod"
               placeholder="计价单位"
@@ -1383,7 +1387,7 @@
               oninput='this.value=this.value.replace(/[^\-?\d.]/g,"").replace(/^(\-)*(\d+)\.(\d\d\d\d).*$/, "$1$2.$3")'
               v-model="scope.row.fQty"
               :disabled="browseStatus"
-              @change="changeEstmateAmt(scope.row)"
+              @change="changeContractAmt(scope.row)"
               placeholder="数量"
               show-word-limit
             />
@@ -1823,6 +1827,7 @@ export default {
     return {
       // 修改查看状态
       browseStatus: false,
+      detailsHidden: false,
       fPlangrossweight: "",
       fPlannetweight: "",
       fPlanvolumn: "",
@@ -1830,9 +1835,9 @@ export default {
       fFeeUnitid: "",
       fFeeUnitids: "",
       fGrossweight: "",
+      fCntqty: "",
       fNetweight: "",
       fQty: "",
-      fCntqty: "",
       fPlangrossweight: 0,
       // 遮罩层
       loading: true,
@@ -2064,7 +2069,7 @@ export default {
         fBsdate: time,
         fGoodsid: null,
         fCntrtype: null,
-        fCntqty: 0,
+        fCntqty: 1,
         fPlangrossweight: 0,
         fPlannetweight: 0,
         fNetweight: 0,
@@ -2261,6 +2266,7 @@ export default {
     },
     /** 修改按钮操作 */
     handleUpdate(row, status) {
+      console.log(status)
       this.browseStatus = status;
       this.reset();
       const fId = row.fId || this.ids;
@@ -2351,7 +2357,7 @@ export default {
           column.property === "fGrossweight" ||
           column.property === "fNetweight" ||
           column.property === "fQty" ||
-          column.property === "fCntqty" 
+          column.property === "fCntqty"
         ) {
           sums[index] = values.reduce((prev, curr) => {
             const value = Number(curr);
@@ -2390,77 +2396,45 @@ export default {
       this.sums = sums;
       return sums;
     },
-    // 收款信息计价单位合计
-    getwarehouseDrList(param) {
-      console.log(param);
+    // 付款合计
+    warehouseDrSummaries(param) {
       const { columns, data } = param;
       const sums = [];
-      var values = [];
       columns.forEach((column, index) => {
         if (index === 0) {
-          sums[index] = "总价";
+          sums[index] = "合计";
           return;
         }
-        if (index === 3) {
-          // values = data.map((item) => Number(item["fFeeUnitid"]));
-           sums[index] = this.fFeeUnitid;
-          return;
-
-        }
-      });
-      this.sums = sums;
-      return sums;
-
-    },
-    // 付款信息计价单位合计
-    getwarehouseCrList(param) {
-      console.log(param);
-      const { columns, data } = param;
-      const sums = [];
-      var values = [];
-      columns.forEach((column, index) => {
-        if (index === 0) {
-          sums[index] = "总价";
-          return;
-        }
-        if (index === 3) {
-          // values = data.map((item) => Number(item["fFeeUnitid"]));
-           sums[index] = this.fFeeUnitids;
-          return;
-
+        const values = data.map((item) => Number(item[column.property]));
+        if (
+          column.property === "fUnitprice" ||
+          column.property === "fAmount" ||
+          column.property === "fQty" ||
+          column.property === "fQty"
+        ) {
+          sums[index] = values.reduce((prev, curr) => {
+            const value = Number(curr);
+            if (!isNaN(value)) {
+              return prev + curr;
+            } else {
+              return prev;
+            }
+          }, 0); // sums[index]
         }
       });
-      this.sums = sums;
       return sums;
-
     },
-
     // 数量计算
     changeContractAmt(row) {
-      if (row.fUnitprice !== "") {
-        if (row.fQty !== "") {
-          this.$set(
-            row,
-            "fAmount",
-            Number(row.fUnitprice) * Number(row.fQty)
-          ).toFixed(2);
-        } else {
-          this.$set(row, "fAmount", row.fUnitprice);
-        }
+      let fQty = 0;
+      let fUnitprice = 0;
+      if (row.fUnitprice) {
+        fUnitprice = row.fUnitprice;
       }
-    },
-    changeEstmateAmt(row) {
-      if (row.fUnitprice !== "") {
-        if (row.fQty !== "") {
-          this.$set(
-            row,
-            "fAmount",
-            Number(row.fUnitprice) * Number(row.fQty)
-          ).toFixed(2);
-        } else {
-          this.$set(row, "fAmount", row.fUnitprice);
-        }
+      if (row.fQty) {
+        fQty = row.fQty;
       }
+      this.$set(row, "fAmount", Number(fUnitprice) * Number(fQty)).toFixed(2);
     },
     changefBsdate(row) {
       if (this.dataList.length > 0) {
@@ -2469,30 +2443,83 @@ export default {
         }
       }
     },
-    // 计价单位选择
-    changefFeeunitid(row) {
-       console.log(row)
-       if(row === "0"){
-         console.log(this.fFeeUnitid)
-         this.fFeeUnitid = this.fCntqty
-       }else{
-         this.fFeeUnitid = this.fGrossweight
-       }
+    // 变更计价单位
+    changeFeeUnit(row) {
+      console.log(this.fCntqty);
+      console.log(row);
+      if (!row.fFeeUnitid) {
+        return false;
+      }
+      if (row.fFeeUnitid === "0") {
+        this.$set(row, "fQty", this.fCntqty);
+      } else if (row.fFeeUnitid === "1") {
+        this.$set(row, "fQty", this.fGrossweight);
+      }
+      if (row.fUnitprice) {
+        this.$set(
+          row,
+          "fAmount",
+          parseFloat(Number(row.fUnitprice) * Number(row.fQty)).toFixed(2)
+        );
+      }
     },
-     // 计价单位选择
-    changefFeeunitids(row) {
-       console.log(row)
-       if(row === "0"){
-         console.log(this.fFeeUnitid)
-         this.fFeeUnitids = this.fCntqty
-       }else{
-         this.fFeeUnitids = this.fGrossweight
-       }
+
+    changefBsdate(row) {
+      if (this.dataList.length > 0) {
+        for (var i = 0; i < this.dataList.length; i++) {
+          this.$set(this.dataList[i], "fBsdate", row);
+        }
+      }
     },
     /** 提交按钮 */
     submitForm(status) {
-      console.log(this.form);
       this.$refs["form"].validate((valid) => {
+        if(status === 2) {
+          console.log("@@")
+          console.log(this.form)
+          console.log(this.dataList)
+          console.log(this.warehouseCrList)
+          console.log(this.warehouseDrList)
+          if (valid) {
+          this.form.fBillstatus = status;
+          this.form.fNetweight = this.fNetweight;
+          this.form.fPlangrossweight = this.fPlangrossweight;
+          this.form.fPlannetweight = this.fPlannetweight;
+          this.form.fPlanvolumn = this.fPlanvolumn;
+          this.form.fPlanqty = this.fPlanqty;
+          this.form.fGrossweight = this.fGrossweight;
+          this.form.fQty = this.fQty;
+          let formData = new window.FormData();
+          // 附件数据
+          formData.append("tWarehouseBills", JSON.stringify(this.form));
+          // 库存明细
+          formData.append(
+            "tWarehousebillsitems",
+            JSON.stringify(this.dataList)
+          );
+          // 附件数据
+          formData.append(
+            "tWhgenleg",
+            JSON.stringify(this.relevantAttachments)
+          );
+          // 费用明细付款
+          formData.append(
+            "tWarehousebillsfeesCr",
+            JSON.stringify(this.warehouseCrList)
+          );
+          // 收款
+          formData.append(
+            "tWarehousebillsfeesDr",
+            JSON.stringify(this.warehouseDrList)
+          );
+          addWarehousebills(formData).then((response) => {
+            this.msgSuccess("提交成功");
+            this.open = false;
+            this.getList();
+          });
+        }
+
+      }else {
         if (this.dataList.length === 0) {
           this.$message.error("请添加库存明细!");
           return false;
@@ -2592,6 +2619,9 @@ export default {
             this.getList();
           });
         }
+
+      }
+        
       });
     },
     /** 删除按钮操作 */

+ 103 - 51
src/views/warehouseBusiness/outStock/index.vue

@@ -239,7 +239,6 @@
       append-to-body
     >
       <el-form
-        style="height: 570px"
         ref="form"
         :model="form"
         :rules="rules"
@@ -461,24 +460,17 @@
             />
           </el-form-item>
         </el-row>
+<!--点击展开-->
+        <el-button
+          @click="
+            detailsHidden ? (detailsHidden = false) : (detailsHidden = true)
+          "
+          >展开</el-button
+        >
+        <div v-if="detailsHidden">
         <el-row style="margin-top: 30px">
           <el-col :span="8">
             <el-form-item label="仓库联系人" prop="fContacts">
-              <!-- <el-select
-                v-model="form.fContacts"
-                filterable
-                remote
-                :remote-method="userRemoteMethod"
-                style="width: 250px"
-                placeholder="请选择仓库联系人"
-              >
-                <el-option
-                  v-for="dict in userOptions"
-                  :key="dict.userName"
-                  :label="dict.nickName"
-                  :value="dict.userName"
-                ></el-option>
-              </el-select> -->
               <el-input
                 v-model="form.fContacts"
                 style="width: 250px"
@@ -652,6 +644,7 @@
             </el-form-item>
           </el-col>
         </el-row>
+        </div>
       </el-form>
       <div class="dialogTableTitle flex a-center jlr">
         <h2>库存明细</h2>
@@ -1042,7 +1035,7 @@
         border
         stripe
         show-summary
-        :summary-method="getwarehouseDrList"
+        :summary-method="warehouseDrSummaries"
       >
         <el-table-column label="序号" type="index" width="80">
         </el-table-column>
@@ -1118,7 +1111,7 @@
             <el-select
               v-model="scope.row.fFeeUnitid"
               placeholder="请选择计费单位"
-              @change="changefFeeunitid"
+              @change="changeFeeUnit(scope.row)"
               :disabled="browseStatus"
               clearable
             >
@@ -1277,7 +1270,7 @@
         border
         stripe
         show-summary
-        :summary-method="getwarehouseCrList"
+        :summary-method="warehouseDrSummaries"
       >
         <el-table-column label="序号" type="index" width="80">
         </el-table-column>
@@ -1358,7 +1351,7 @@
             <el-select
               v-model="scope.row.fFeeUnitid"
               placeholder="请选择计费单位"
-              @change="changefFeeunitids"
+              @change="changeFeeUnit(scope.row)"
               :disabled="browseStatus"
               clearable
             >
@@ -1901,6 +1894,7 @@
         fFeeUnitid: "",
         fFeeUnitids: "",
         browseStatus: false,
+        detailsHidden: false,
         fGrossweight: '',
         fNetweight: '',
         fQty: '',
@@ -2170,16 +2164,17 @@
         for (let whgen in this.dialogWhgenlegList) {
           this.dataList.push({
             fMblno: this.dialogWhgenlegList[whgen].fMblno,
-            fGoodsid: this.dialogWhgenlegList[whgen].fGoodsids,
+            fGoodsid: this.dialogWhgenlegList[whgen].fGoodsid,
             fCntrtype: null,
             fQtyblc: this.dialogWhgenlegList[whgen].fQtyblc,
             fWarehouseLocationids: this.dialogWhgenlegList[whgen].fWarehouseLocationids,
-            fGoodsids: this.dialogWhgenlegList[whgen].fGoodsid,
-            fgrossweight: null,
-            fNetweight: null,
-            fQty: null,
+            fGoodsids: this.dialogWhgenlegList[whgen].fGoodsids,
+            fGrossweight: 0,
+            fNetweight: 0,
+            fQty: 0,
+            fCntqty: 1,
             fPackagespecs: null,
-            fWarehouselocid: this.dialogWhgenlegList[whgen].fWarehouseLocationids,
+            fWarehouselocid: this.dialogWhgenlegList[whgen].fWarehouseLocationid,
             fCntrno: this.dialogWhgenlegList[whgen].fCntrno,
             fGoodsval: null,
             fTruckno: null,
@@ -2512,28 +2507,47 @@
    return sums
 
     },
-      // 收款信息计价单位合计
-    getwarehouseDrList(param) {
-      console.log(param);
-      const { columns, data } = param;
-      const sums = [];
-      var values = [];
-      columns.forEach((column, index) => {
+      // 付款合计
+    warehouseDrSummaries (param) {
+        const {columns, data} = param
+         const sums = []
+      columns.forEach((column, index) => {
         if (index === 0) {
-          sums[index] = "总价";
-          return;
-        }
-        if (index === 3) {
-          // values = data.map((item) => Number(item["fFeeUnitid"]));
-           sums[index] = this.fFeeUnitid;
-          return;
-
-        }
-      });
-      this.sums = sums;
-      return sums;
+              sums[index] = '合计'
+                return
+              }
+        const values = data.map(item => Number(item[column.property]))
+        if (column.property === 'fUnitprice' || column.property === 'fAmount'|| column.property === 'fQty'|| column.property === 'fQty') {
+          sums[index] = values.reduce((prev, curr) => {
+            const value = Number(curr)
+            if (!isNaN(value)) {
+              return prev + curr
+            } else {
+              return prev
+            }
+          }, 0)
+          // sums[index]
+        }
+      })
+   return sums
 
     },
+     // 变更计价单位
+    changeFeeUnit (row) {
+      console.log(this.fCntqty)
+      console.log(row)
+      if (!row.fFeeUnitid) {
+        return false
+      }
+      if (row.fFeeUnitid === '0') {
+        this.$set(row, 'fQty', this.fCntqty)
+      } else if (row.fFeeUnitid === '1') {
+        this.$set(row, 'fQty', this.fGrossweight)
+      }
+      if (row.fUnitprice) {
+        this.$set(row, 'fAmount', parseFloat(Number(row.fUnitprice) * Number(row.fQty)).toFixed(2))
+      }
+    },
     // 付款信息计价单位合计
     getwarehouseCrList(param) {
       console.log(param);
@@ -2579,13 +2593,50 @@
     },
       /** 提交按钮 */
       submitForm(status) {
-        console.log(this.form.fGrossweight)
-        console.log(this.dataList)
-        // if(typeof this.form.fBillstatus === 'undefined' || this.form.fBillstatus==null) {
-        //   this.form.fBillstatus = 6;
-        // }
-        
         this.$refs["form"].validate((valid) => {
+          console.log(this.dataList)
+          if(status === 2) {
+          if (valid) {
+          this.form.fBillstatus = status;
+          this.form.fNetweight = this.fNetweight;
+          this.form.fPlangrossweight = this.fPlangrossweight;
+          this.form.fPlannetweight = this.fPlannetweight;
+          this.form.fPlanvolumn = this.fPlanvolumn;
+          this.form.fPlanqty = this.fPlanqty;
+          this.form.fGrossweight = this.fGrossweight;
+          this.form.fQty = this.fQty;
+          console.log(this.amt);
+          let formData = new window.FormData();
+          // 附件数据
+          formData.append("tWarehouseBills", JSON.stringify(this.form));
+          // 库存明细
+          formData.append(
+            "tWarehousebillsitems",
+            JSON.stringify(this.dataList)
+          );
+          // 附件数据
+          formData.append(
+            "tWhgenleg",
+            JSON.stringify(this.relevantAttachments)
+          );
+          // 费用明细付款
+          formData.append(
+            "tWarehousebillsfeesCr",
+            JSON.stringify(this.warehouseCrList)
+          );
+          // 收款
+          formData.append(
+            "tWarehousebillsfeesDr",
+            JSON.stringify(this.warehouseDrList)
+          );
+          addWarehousebills(formData).then((response) => {
+            this.msgSuccess("提交成功");
+            this.open = false;
+            this.getList();
+          });
+        }
+
+      }else {
           if (this.dataList.length ===  0) {
           this.$message.error('请添加库存明细!')
           return false
@@ -2662,6 +2713,7 @@
               this.getList();
             });
           }
+      }
         });
       },
       /** 删除按钮操作 */