Browse Source

修改检索流程

Qukatie 1 month ago
parent
commit
f5b688019e

+ 3 - 0
src/enums/column-name.js

@@ -2087,6 +2087,9 @@ const columnName = [{
 },{
   code: 478,
   name: '中心仓库-入库管理-费用明细'
+},{
+  code: 479,
+  name: '货代-财务管理-对账中心(F)费用信息表'
 }
 ]
 export const getColumnName = (key) => {

+ 19 - 19
src/views/iosBasicData/finstlbills/assembly/finstlbillsitems.vue

@@ -9,9 +9,9 @@
       :header-cell-style="tableHeaderCellStyle"
       :row-class-name="rowClassName"
       :cell-style="cellStyle"
-      :page.sync="page2"
-      @size-change="sizeChange2"
-      @current-change="currentChange2"
+      :page.sync="page"
+      @size-change="sizeChange"
+      @current-change="currentChange"
       @resetColumn="resetColumn('crud', 'option', 'optionBack', 455)"
       @saveColumn="saveColumn('crud', 'option', 'optionBack', 455)"
     >
@@ -71,7 +71,7 @@ import { feecenterSelectByAccNoList } from "@/api/iosBasicData/finstlbills";
 export default {
   components: { SearchQuery, costDetails },
   props: {
-    tableData: {
+    queryData: {
       type: Array,
       default: []
     },
@@ -362,7 +362,7 @@ export default {
           }
         ]
       },
-      page2: {
+      page: {
         currentPage: 1,
         total: 0,
         pageSize: 20,
@@ -377,20 +377,20 @@ export default {
     this.invoicelosWorkDictsfun();
   },
   methods: {
-    sizeChange2(val) {
-      this.page2.currentPage = 1;
-      this.page2.pageSize = val;
+    sizeChange(val) {
+      this.page.currentPage = 1;
+      this.page.pageSize = val;
       this.getList2();
     },
-    currentChange2(val) {
-      this.page2.currentPage = val;
+    currentChange(val) {
+      this.page.currentPage = val;
       this.getList2();
     },
     getList2() {
-      this.page2.total = this.tableData.length;
-      const start = (this.page2.currentPage - 1) * this.page2.pageSize;
-      const end = start + this.page2.pageSize;
-      this.pageData2 = this.tableData.slice(start, end);
+      this.page.total = this.queryData.length;
+      const start = (this.page.currentPage - 1) * this.page.pageSize;
+      const end = start + this.page.pageSize;
+      this.pageData2 = this.queryData.slice(start, end);
     },
     armbChange(row) {
       if (Number(row.amount - row.reconciliationAmount) > 0) {
@@ -505,14 +505,14 @@ export default {
     // 多选选择的数据
     handleSelectionChange(arr) {
       // // 全选
-      // if (arr.length == this.tableData.length) {
+      // if (arr.length == this.queryData.length) {
       //     for (let item of arr) {
       //         this.$set(item,'tableSelect',1)
       //     }
       // }
       // // 清除全选
       // if (arr.length == 0) {
-      //     for (let item of this.tableData) {
+      //     for (let item of this.queryData) {
       //         this.$set(item,'tableSelect',0)
       //     }
       // }
@@ -541,7 +541,7 @@ export default {
         refsElTable.clearSelection(); //先清空 不然会导致在这两行中间之外的行状态不变
         for (let index = topAndBottom.top; index <= topAndBottom.bottom; index++) {
           //选中两行之间的所有行
-          refsElTable.toggleRowSelection(this.tableData[index], true);
+          refsElTable.toggleRowSelection(this.queryData[index], true);
         }
       } else {
         let findRow = this.handleSelectionData.find(c => c.rowIndex == row.rowIndex); //找出当前选中行
@@ -655,10 +655,10 @@ export default {
     removeEventListener("keyup", this.keyUp);
   },
   watch: {
-    tableData: {
+    queryData: {
       // 执行方法
       handler(oldValue, newValue) {
-        this.page2.currentPage = 1;
+        this.page.currentPage = 1;
         this.pageData2 = [];
         this.getList2();
       },

+ 699 - 0
src/views/iosBasicData/finstlbills/assembly/finstlbillsitems2.vue

@@ -0,0 +1,699 @@
+<template>
+  <div>
+    <avue-crud
+      :option="option"
+      :data="pageData"
+      id="out-table"
+      ref="crud"
+      @selection-change="handleSelectionChange"
+      :header-cell-style="tableHeaderCellStyle"
+      :row-class-name="rowClassName"
+      :cell-style="cellStyle"
+      :page.sync="page"
+      @size-change="sizeChange"
+      @current-change="currentChange"
+      @resetColumn="resetColumn('crud', 'option', 'optionBack', 479)"
+      @saveColumn="saveColumn('crud', 'option', 'optionBack', 479)"
+    >
+      <template slot="menuLeft">
+        <slot name="menuLeft"></slot>
+      </template>
+      <tempalte slot="currentStlAmountRMB" slot-scope="{ row }">
+        <el-input-number
+          v-if="brfalse"
+          v-model="row.currentStlAmountRMB"
+          @change="armbChange(row)"
+          :controls="false"
+          placeholder="请输入 本次对账CNY"
+          size="mini"
+          style="width: 100%;"
+          :disabled="row.currentStlCurCode != 'CNY'"
+        ></el-input-number>
+        <span v-else>{{ row.currentStlAmountRMB }}</span>
+      </tempalte>
+      <tempalte slot="currentStlAmountUSD" slot-scope="{ row }">
+        <el-input-number
+          v-if="brfalse"
+          v-model="row.currentStlAmountUSD"
+          @change="ausdChange(row)"
+          :controls="false"
+          placeholder="请输入 本次对账USD"
+          size="mini"
+          style="width: 100%;"
+          :disabled="row.currentStlCurCode != 'USD'"
+        ></el-input-number>
+        <span v-else>{{ row.currentStlAmountUSD }}</span>
+      </tempalte>
+      <template slot="stlAmountDr" slot-scope="{ row }">
+        <span v-if="row.dc == 'D'">{{ row.stlAmountDr }}</span>
+        <span v-if="row.dc == 'C'">{{ row.stlAmountCr }}</span>
+      </template>
+      <template slot="stlAmountDrUSD" slot-scope="{ row }">
+        <span v-if="row.dc == 'D'">{{ row.stlAmountDrUSD }}</span>
+        <span v-if="row.dc == 'C'">{{ row.stlAmountCrUSD }}</span>
+      </template>
+      <template slot="remarkss" slot-scope="{ row }">
+        <el-input style="width: 100%;" v-model="row.remarkss" v-if="brfalse" size="mini" autocomplete="off" clearable placeholder="请输入 备注">
+        </el-input>
+        <span v-else>{{ row.remarkss }}</span>
+      </template>
+    </avue-crud>
+  </div>
+</template>
+
+<script>
+import { getWorkDicts } from "@/api/system/dictbiz";
+import SearchQuery from "@/components/iosbasic-data/searchquery.vue";
+import costDetails from "../assembly/costDetails.vue";
+import { getRateList } from "@/api/iosBasicData/rateManagement";
+import { feecenterSelectByAccNoList } from "@/api/iosBasicData/finstlbills";
+
+export default {
+  components: { SearchQuery, costDetails },
+  props: {
+    tableData: {
+      type: Array,
+      default: []
+    },
+    brfalse: {
+      type: Boolean,
+      default: true
+    },
+    handleSelectionData: {
+      type: Array,
+      default: []
+    },
+    form: {
+      type: Object,
+      default: {}
+    },
+    editSave: {
+      type: Boolean,
+      default: false
+    }
+  },
+  data() {
+    return {
+      ifInvoiceData: [], // 是否数据
+      invoicelosDara: [], // 发票
+      curCodeData: [], // 币种
+      option: {},
+      optionBack: {
+        height: "auto",
+        calcHeight: 30,
+        menuWidth: 60,
+        tip: false,
+        menu: false,
+        border: true,
+        addBtn: false,
+        viewBtn: false,
+        editBtn: false,
+        delBtn: false,
+        refreshBtn: false,
+        index: true,
+        selection: true,
+        align: "center",
+        column: [
+          {
+            label: "原业务编号",
+            prop: "billNo",
+            width: 120,
+            overHidden: true
+          },
+          {
+            label: "发票号",
+            prop: "invoiceNo",
+            width: 80,
+            overHidden: true
+          },
+          {
+            label: "结算单位",
+            prop: "corpCnName",
+            width: 120,
+            overHidden: true
+          },
+          {
+            label: "MB/L NO",
+            prop: "mblno",
+            width: 100,
+            overHidden: true
+          },
+          {
+            label: "本次对账CNY",
+            prop: "currentStlAmountRMB",
+            width: 100,
+            overHidden: true
+          },
+          {
+            label: "本次对账USD",
+            prop: "currentStlAmountUSD",
+            width: 100,
+            overHidden: true
+          },
+          {
+            label: "币种",
+            prop: "currentStlCurCode",
+            width: 60,
+            overHidden: true
+          },
+          {
+            label: "汇率",
+            prop: "currentStlExrate",
+            width: 80,
+            overHidden: true
+          },
+          {
+            label: "对账",
+            prop: "isChecked",
+            width: 60,
+            overHidden: true,
+            type: "select",
+            dicData: [
+              {
+                label: "否",
+                value: 0
+              },
+              {
+                label: "是",
+                value: 1
+              }
+            ]
+          },
+          {
+            label: "签收",
+            prop: "isSignfor",
+            width: 60,
+            overHidden: true,
+            type: "select",
+            dicData: [
+              {
+                label: "否",
+                value: 0
+              },
+              {
+                label: "是",
+                value: 1
+              }
+            ]
+          },
+          {
+            label: "发票状态",
+            prop: "isInvoice",
+            width: 80,
+            type: "select",
+            dicData: [
+              {
+                label: "待开发票",
+                value: 1
+              },
+              {
+                label: "确认开票",
+                value: 2
+              },
+              {
+                label: "不开发票",
+                value: 3
+              }
+            ],
+            overHidden: true
+          },
+          {
+            label: "ETD",
+            prop: "etd",
+            width: 100,
+            overHidden: true
+          },
+          {
+            label: "账单编号",
+            prop: "accBillNo",
+            width: 100,
+            overHidden: true
+          },
+          {
+            label: "签收人",
+            prop: "signforName",
+            width: 80,
+            overHidden: true
+          },
+          {
+            label: "签收日期",
+            prop: "signforDate",
+            width: 100,
+            overHidden: true
+          },
+          {
+            label: "操作人",
+            prop: "operatorName",
+            width: 80,
+            overHidden: true
+          },
+          {
+            label: "BOOKINGNO",
+            prop: "bookingNo",
+            width: 100,
+            overHidden: true
+          },
+          {
+            label: "HB/L NO",
+            prop: "hblno",
+            width: 100,
+            overHidden: true
+          },
+          {
+            label: "船名",
+            prop: "vesselCnName",
+            width: 80,
+            overHidden: true
+          },
+          {
+            label: "航次",
+            prop: "voyageNo",
+            width: 80,
+            overHidden: true
+          },
+          {
+            label: "发票CNY",
+            prop: "currentInvoiceAmountRMB",
+            width: 80,
+            overHidden: true
+          },
+          {
+            label: "发票USD",
+            prop: "currentInvoiceAmountUSD",
+            width: 80,
+            overHidden: true
+          },
+          {
+            label: "箱量",
+            prop: "quantityCntrTypesDescr",
+            width: 80,
+            overHidden: true
+          },
+          {
+            label: "收付",
+            prop: "dc",
+            width: 60,
+            type: "select",
+            dicData: [
+              {
+                label: "收",
+                value: "D"
+              },
+              {
+                label: "付",
+                value: "C"
+              }
+            ],
+            overHidden: true
+          },
+          {
+            label: "应对账CNY",
+            prop: "unsettledAmountRMB",
+            width: 100,
+            overHidden: true
+          },
+          {
+            label: "应对账USD",
+            prop: "unsettledAmountUSD",
+            width: 100,
+            overHidden: true
+          },
+          {
+            label: "已对账CNY",
+            prop: "reconciliationAmount",
+            width: 100,
+            overHidden: true
+          },
+          {
+            label: "已对账USD",
+            prop: "reconciliationAmountUsd",
+            width: 100,
+            overHidden: true
+          },
+          {
+            label: "已结算CNY",
+            prop: "stlAmountDr",
+            width: 90,
+            overHidden: true
+          },
+          {
+            label: "已结算USD",
+            prop: "stlAmountDrUSD",
+            width: 90,
+            overHidden: true
+          },
+          // {
+          //     label: "费用名称",
+          //     prop: "feeCnName",
+          //     width: 80,
+          //     overHidden: true
+          // },
+          {
+            label: "业务员",
+            prop: "srcCnName",
+            width: 80,
+            overHidden: true
+          },
+          {
+            label: "备注",
+            prop: "remarkss",
+            width: 120,
+            overHidden: true
+          }
+        ]
+      },
+      page: {
+        currentPage: 1,
+        total: 0,
+        pageSize: 20,
+        pageSizes: [20, 50, 100, 200, 500]
+      },
+      pageData: []
+    };
+  },
+  async created() {
+    this.option = await this.getColumnData(this.getColumnName(479), this.optionBack);
+    
+    this.isSignforWorkDicts();
+    this.invoicelosWorkDictsfun();
+  },
+  methods: {
+    sizeChange(val) {
+      this.page.currentPage = 1;
+      this.page.pageSize = val;
+      this.getList2();
+    },
+    currentChange(val) {
+      this.page.currentPage = val;
+      this.getList2();
+    },
+    getList2() {
+      this.page.total = this.tableData.length;
+      const start = (this.page.currentPage - 1) * this.page.pageSize;
+      const end = start + this.page.pageSize;
+      this.pageData = this.tableData.slice(start, end);
+    },
+    armbChange(row) {
+      if (Number(row.amount - row.reconciliationAmount) > 0) {
+        if (Number(row.currentStlAmountRMB) < 0) {
+          row.currentStlAmountRMB = 0;
+          return this.$message.error("本次对账金额不能输入负数");
+        }
+        if (Number(row.currentStlAmountRMB) > Number(row.amount - row.reconciliationAmount)) {
+          row.currentStlAmountRMB = 0;
+          return this.$message.error("本次对账金额不能超过未对账金额");
+        }
+      }
+      if (Number(row.amount - row.reconciliationAmount) < 0) {
+        if (row.currentStlAmountRMB >= 0) {
+          row.currentStlAmountRMB = Number(row.amount - row.reconciliationAmount);
+          return this.$message.error("本次对账金额不能输入非负数");
+        }
+        if (Number(row.currentStlAmountRMB) < Number(row.amount - row.reconciliationAmount)) {
+          row.currentStlAmountRMB = Number(row.amount - row.reconciliationAmount);
+          return this.$message.error("本次对账金额不能超过未对账金额");
+        }
+      }
+    },
+    ausdChange(row) {
+      if (Number(row.amount - row.reconciliationAmount) > 0) {
+        if (Number(row.currentStlAmountUSD) < 0) {
+          row.currentStlAmountUSD = 0;
+          return this.$message.error("本次对账金额不能输入负数");
+        }
+        if (Number(row.currentStlAmountUSD) > Number(row.amount - row.reconciliationAmount)) {
+          row.currentStlAmountUSD = 0;
+          return this.$message.error("本次对账金额不能超过未对账金额");
+        }
+      }
+      if (Number(row.amount - row.reconciliationAmount) < 0) {
+        if (row.currentStlAmountUSD >= 0) {
+          row.currentStlAmountUSD = Number(row.amount - row.reconciliationAmount);
+          return this.$message.error("本次对账金额不能输入非负数");
+        }
+        if (Number(row.currentStlAmountUSD) < Number(row.amount - row.reconciliationAmount)) {
+          row.currentStlAmountUSD = Number(row.amount - row.reconciliationAmount);
+          return this.$message.error("本次对账金额不能超过未对账金额");
+        }
+      }
+    },
+    // 币别选择监听
+    corpChange(value, row) {
+      for (let item of this.curCodeData) {
+        if (item.code == value) {
+          this.$set(row, "currentStlCurCode", value);
+          if (value == "CNY") {
+            delete row.currentStlAmountUSD;
+            this.$set(row, "currentStlAmountRMB", row.unsettledAmount);
+          } else {
+            delete row.currentStlAmountRMB;
+            this.$set(row, "currentStlAmountUSD", row.unsettledAmount);
+          }
+        }
+      }
+    },
+    // 展开行或者关闭
+    expandChange(row, expandedRows) {
+      let accBillId = "";
+      if (this.form.id) {
+        accBillId = row.accBillId;
+      } else {
+        accBillId = row.id;
+      }
+      feecenterSelectByAccNoList({ accBillId }).then(res => {
+        row.costDate = res.data.data.map(item => {
+          if (item.curCode == "CNY") {
+            this.$set(item, "rmbAmount", item.amount);
+            this.$set(item, "usdAmount", "");
+            this.$set(item, "rmbAmountNet", item.amountNet);
+            this.$set(item, "usdAmountNet", "");
+          } else {
+            this.$set(item, "usdAmount", item.amount);
+            this.$set(item, "rmbAmount", "");
+            this.$set(item, "usdAmountNet", item.amountNet);
+            this.$set(item, "rmbAmountNet", "");
+          }
+          return item;
+        });
+      });
+    },
+    // 接口请求
+    // 是否接口
+    isSignforWorkDicts() {
+      getWorkDicts("ifInvoice").then(res => {
+        this.ifInvoiceData = res.data.data;
+      });
+    },
+    // 发票
+    invoicelosWorkDictsfun() {
+      getWorkDicts("reconciliation_invoice_los").then(res => {
+        this.invoicelosDara = res.data.data;
+      });
+    },
+    // 获取币别数据
+    getRateListfun(cnName) {
+      getRateList({ current: 1, size: 10, cnName }).then(res => {
+        this.curCodeData = res.data.data.records;
+      });
+    },
+
+    // 表头样式
+    tableHeaderCellStyle({ row, column, rowIndex, columnIndex }) {
+      return "padding:4px 0px;fontSize:12px;color:#000;background:#ecf5ff";
+    },
+
+    // Element UI 表格点击选中行/取消选中 快捷多选 以及快捷连续多选,高亮选中行 ——-------------------------------------——
+    // 多选选择的数据
+    handleSelectionChange(arr) {
+      // // 全选
+      // if (arr.length == this.tableData.length) {
+      //     for (let item of arr) {
+      //         this.$set(item,'tableSelect',1)
+      //     }
+      // }
+      // // 清除全选
+      // if (arr.length == 0) {
+      //     for (let item of this.tableData) {
+      //         this.$set(item,'tableSelect',0)
+      //     }
+      // }
+      this.$emit("handleSelectionChange", arr);
+    },
+    // // 多选
+    // toggleSelection(rows){
+    //     if (rows) {
+    //         rows.forEach(row => {
+    //             this.$refs.tableRef.toggleRowSelection(row);
+    //         });
+    //     } else {
+    //         this.$refs.tableRef.clearSelection();
+    //     }
+    // },
+    // 监听点击表格事件
+    rowClick(row, column, event) {
+      let refsElTable = this.$refs.tableRef; // 获取表格对象
+      if (this.CtrlDown) {
+        refsElTable.toggleRowSelection(row); // ctrl多选 如果点击两次同样会取消选中
+        return;
+      }
+      if (this.shiftOrAltDown && this.handleSelectionData.length > 0) {
+        // 通过rowIndex判断已选择的行中最上面和最下面的是哪行,再对比按住shift/alt点击的当前行得到新的最上面和最下面的行,把这两行中间的行进行循环选中。
+        let topAndBottom = this.getTopAndBottom(row, this.bottomSelectionRow, this.topSelectionRow);
+        refsElTable.clearSelection(); //先清空 不然会导致在这两行中间之外的行状态不变
+        for (let index = topAndBottom.top; index <= topAndBottom.bottom; index++) {
+          //选中两行之间的所有行
+          refsElTable.toggleRowSelection(this.tableData[index], true);
+        }
+      } else {
+        let findRow = this.handleSelectionData.find(c => c.rowIndex == row.rowIndex); //找出当前选中行
+        //如果只有一行且点击的也是这一行则取消选择 否则清空再选中当前点击行
+        if (findRow && this.handleSelectionData.length === 1) {
+          refsElTable.toggleRowSelection(row, false);
+          return;
+        }
+        // refsElTable.clearSelection(); // 清空之前选择的数据(如果放开,选择之前会变成单选)
+        refsElTable.toggleRowSelection(row); // 调用选中行方法
+      }
+    },
+    // 行的 style 的回调方法
+    rowStyle({ row, rowIndex }) {
+      // 直接在一个对象上定义一个新属性,或者修改一个对象的现有属性,并返回此对象
+      // object: 要添加或者修改属性的目标对象;prop: 要定义或修改属性的名称;descript: 是一个对象,里面是我们上述的对象属性的特性;
+      Object.defineProperty(row, "rowIndex", {
+        //给每一行添加不可枚举属性rowIndex来标识当前行
+        value: rowIndex, // 设置age的值,不设置的话默认为undefined
+        writable: true, // 表示属性的值true可以修改,false不可以被修改
+        enumerable: false // 设置为false表示不能通过 for-in 循环返回
+        // configurable: false, // configurable 设置为 false,意味着这个属性不能从对象上删除
+      });
+    },
+    keyDown(event) {
+      let key = event.keyCode;
+      if (key == 17) this.CtrlDown = true;
+      if (key == 16 || key == 18) this.shiftOrAltDown = true;
+    },
+    keyUp(event) {
+      let key = event.keyCode;
+      if (key == 17) this.CtrlDown = false;
+      if (key == 16 || key == 18) this.shiftOrAltDown = false;
+    },
+    // 文章说明 https://www.jianshu.com/p/48f2c522d2a2
+    getTopAndBottom(row, bottom, top) {
+      let n = row.rowIndex,
+        mx = bottom.rowIndex,
+        mi = top.rowIndex;
+      if (n > mx) {
+        return {
+          top: mi,
+          bottom: n
+        };
+      } else if (n < mx && n > mi) {
+        return {
+          top: mi,
+          bottom: n
+        };
+      } else if (n < mi) {
+        return {
+          top: n,
+          bottom: mx
+        };
+      } else if (n == mi || n == mx) {
+        return {
+          top: mi,
+          bottom: mx
+        };
+      }
+    },
+    // 给选中行加上current-row这个class类,所以要使用row-class-name这个属性(其实给每一行添加rowIndex也可以用这个属性),
+    // 判断方式也是通过判断rowIndex对比
+    rowClassName({ row, rowIndex }) {
+      let rowName = "",
+        findRow = this.handleSelectionData.find(c => {
+          return c.rowIndex === row.rowIndex;
+        });
+      if (findRow) {
+        rowName = "current-row "; // elementUI 默认高亮行的class类 不用再样式了^-^,也可通过css覆盖改变背景颜色
+      }
+      return rowName; //也可以再加上其他类名 如果有需求的话
+    },
+    // 收付展示不一样的颜色
+    cellStyle({ row, rowIndex, columnIndex }) {
+      let rowStyle = "";
+      if (row.dc == "D") {
+        rowStyle = "color:#8cb24b;";
+      } else if (row.dc == "C") {
+        rowStyle = "color:#F56C6C;";
+      }
+      return rowStyle + "padding:0px;fontSize:12px";
+    },
+    //自定义列保存
+    async saveColumn(ref, option, optionBack, code) {
+      const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
+      if (inSave) {
+        this.$message.success("保存成功");
+        //关闭窗口
+        this.$refs[ref].$refs.dialogColumn.columnBox = false;
+      }
+    },
+    //自定义列重置
+    async resetColumn(ref, option, optionBack, code) {
+      this[option] = this[optionBack];
+      const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
+      if (inSave) {
+        this.$message.success("重置成功");
+        this.$refs[ref].$refs.dialogColumn.columnBox = false;
+      }
+    }
+  },
+  mounted() {
+    // 按住ctrl实现多选 设置监听keydown事件,以及keyup事件,
+    addEventListener("keydown", this.keyDown, false);
+    addEventListener("keyup", this.keyUp, false);
+  },
+  beforeDestroy() {
+    //解绑
+    removeEventListener("keydown", this.keyDown);
+    removeEventListener("keyup", this.keyUp);
+  },
+  watch: {
+    tableData: {
+      // 执行方法
+      handler(oldValue, newValue) {
+        this.page.currentPage = 1;
+        this.pageData = [];
+        this.getList2();
+      },
+      deep: true, // 深度监听
+      immediate: true // 第一次改变就执行
+    }
+  },
+  computed: {
+    //实时得到最上行和最下行
+    bottomSelectionRow() {
+      if (this.handleSelectionData.length == 0) return null;
+      return this.handleSelectionData.reduce((start, end) => {
+        return start.rowIndex > end.rowIndex ? start : end;
+      });
+    },
+    topSelectionRow() {
+      if (this.handleSelectionData.length == 0) return null;
+      return this.handleSelectionData.reduce((start, end) => {
+        return start.rowIndex < end.rowIndex ? start : end;
+      });
+    }
+  }
+};
+</script>
+
+<style scoped>
+.textHide {
+  width: 100%;
+  overflow: hidden;
+  white-space: nowrap;
+  text-overflow: ellipsis;
+}
+
+::v-deep .current-row {
+  background: #ecf3ff;
+}
+</style>

+ 141 - 110
src/views/iosBasicData/finstlbills/finstlbillsDetails.vue

@@ -583,7 +583,7 @@
               <el-col span="24">
                 <div style="text-align: right">
                   <el-button size="small" type="primary" :disabled="editSave" :loading="saveLoading" @click="retrievalfun">检 索 </el-button>
-                  <el-button size="small" :disabled="tableData.length > 0" @click="ResetFilter">重置条件 </el-button>
+                  <el-button size="small" :disabled="queryData.length > 0" @click="ResetFilter">重置条件 </el-button>
                 </div>
               </el-col>
             </el-row>
@@ -646,63 +646,82 @@
       </el-card>
 
       <el-card style="margin-top: 10px">
-        <finstlbillsitems
-          :tableData="tableData"
-          :form="form"
-          :handleSelectionData="handleSelectionData"
-          :brfalse="!editSave"
-          @handleSelectionChange="handleSelectionChange"
-        >
-          <template slot="menuLeft">
-            <div>
-              <el-button size="small" type="info" style="margin-right: 8px" :disabled="editSave" :loading="saveLoading" @click="SelectedRows"
-                >确认选定行
-              </el-button>
-              <el-button size="small" type="danger" style="margin-left: 10px" :disabled="editSave" :loading="saveLoading" @click="batchDeletefun"
-                >一键删除
-              </el-button>
-              <el-button size="small" type="primary" style="margin-left: 10px" :disabled="editSave" :loading="saveLoading" @click="editHandle"
-                >一键编辑
-              </el-button>
-              <el-button
-                size="small"
-                type="primary"
-                style="margin-right: 8px"
-                :disabled="editSave"
-                :loading="saveLoading"
-                @click="Confirminvoicefun('2')"
-                >不开发票
-              </el-button>
-              <el-button
-                size="small"
-                type="warning"
-                style="margin-right: 8px"
-                :disabled="editSave"
-                :loading="saveLoading"
-                @click="Notinvoicingfun('2')"
-                >取消不开发票
-              </el-button>
-              <el-button
-                size="small"
-                type="primary"
-                style="margin-right: 8px"
-                :disabled="editSave"
-                :loading="saveLoading"
-                @click="Confirminvoicefun('1')"
-                >确认开票
-              </el-button>
-              <el-button
-                size="small"
-                type="warning"
-                style="margin-right: 8px"
-                :disabled="editSave"
-                :loading="saveLoading"
-                @click="Notinvoicingfun('1')"
-                >撤销开票
-              </el-button>
-            </div>
-          </template>
-        </finstlbillsitems>
+        <el-tabs v-model="activeName" @tab-click="handleClick">
+          <el-tab-pane label="查询结果" name="1">
+            <queryfinstlbillsitems
+              :queryData="queryData"
+              :tableData="tableData"
+              :form="form"
+              :handleSelectionData="handleSelectionData"
+              :brfalse="!editSave"
+              @handleSelectionChange="addSelectionChange"
+            >
+              <template slot="menuLeft">
+                <div>
+                  <el-button size="small" type="success" style="margin-right: 8px" :disabled="editSave" :loading="saveLoading" @click="allCell"
+                    >确认选定行
+                  </el-button>
+                </div>
+              </template>
+            </queryfinstlbillsitems>
+          </el-tab-pane>
+          <el-tab-pane label="选定数据" name="2">
+            <finstlbillsitems
+              :tableData="tableData"
+              :form="form"
+              :handleSelectionData="handleSelectionData"
+              :brfalse="!editSave"
+              @handleSelectionChange="handleSelectionChange"
+            >
+              <template slot="menuLeft">
+                <div>
+                  <el-button size="small" type="danger" style="margin-left: 10px" :disabled="editSave" :loading="saveLoading" @click="batchDeletefun"
+                    >一键删除
+                  </el-button>
+                  <el-button size="small" type="primary" style="margin-left: 10px" :disabled="editSave" :loading="saveLoading" @click="editHandle"
+                    >一键编辑
+                  </el-button>
+                  <el-button
+                    size="small"
+                    type="primary"
+                    style="margin-right: 8px"
+                    :disabled="editSave"
+                    :loading="saveLoading"
+                    @click="Confirminvoicefun('2')"
+                    >不开发票
+                  </el-button>
+                  <el-button
+                    size="small"
+                    type="warning"
+                    style="margin-right: 8px"
+                    :disabled="editSave"
+                    :loading="saveLoading"
+                    @click="Notinvoicingfun('2')"
+                    >取消不开发票
+                  </el-button>
+                  <el-button
+                    size="small"
+                    type="primary"
+                    style="margin-right: 8px"
+                    :disabled="editSave"
+                    :loading="saveLoading"
+                    @click="Confirminvoicefun('1')"
+                    >确认开票
+                  </el-button>
+                  <el-button
+                    size="small"
+                    type="warning"
+                    style="margin-right: 8px"
+                    :disabled="editSave"
+                    :loading="saveLoading"
+                    @click="Notinvoicingfun('1')"
+                    >撤销开票
+                  </el-button>
+                </div>
+              </template>
+            </finstlbillsitems>
+          </el-tab-pane>
+        </el-tabs>
       </el-card>
     </div>
 
@@ -778,7 +797,8 @@ import {
   finstlbillsRevokeInvoicing
 } from "@/api/iosBasicData/finstlbills";
 import expand from "@/components/basic-container/expand.vue";
-import finstlbillsitems from "@/views/iosBasicData/finstlbills/assembly/finstlbillsitems.vue";
+import queryfinstlbillsitems from "@/views/iosBasicData/finstlbills/assembly/finstlbillsitems.vue";
+import finstlbillsitems from "@/views/iosBasicData/finstlbills/assembly/finstlbillsitems2.vue";
 import { dateFormat } from "@/util/date";
 import reports from "@/views/iosBasicData/SeafreightExportF/bills/assembly/reports.vue";
 import reportformsList from "@/views/iosBasicData/SeafreightExportF/bills/assembly/reportformsList.vue";
@@ -786,7 +806,7 @@ import reportContainer from "@/views/iosBasicData/report-container/report-contai
 import { getList as getreportsList, reportsGetReportData } from "@/api/iosBasicData/reports";
 import dicSelect from "@/components/dicSelect/main";
 export default {
-  components: { reportContainer, reportformsList, reports, SearchQuery, expand, finstlbillsitems, dicSelect },
+  components: { reportContainer, reportformsList, reports, SearchQuery, expand, finstlbillsitems, dicSelect, queryfinstlbillsitems },
   props: {
     // 编辑还是保存
     editSave: {
@@ -800,6 +820,7 @@ export default {
   },
   data() {
     return {
+      activeName: "1",
       retrievePopupsType: false, // 弹窗开启关闭
       retrievePopupsData: [], // 选择弹窗数据
       retrievePopupsOption: {
@@ -832,6 +853,8 @@ export default {
       selectPrintingDialog: false, // 预览报表
       statusType: false, // 确认发票
       tableData: [],
+      queryData: [],
+      addData: [],
       pageLoading: false, // 全屏加载动画
       saveLoading: false, // 按钮动画
       // 绑定的数据
@@ -905,7 +928,7 @@ export default {
     this.invoiceWorkDictsfun(); // 获取 发票的数据
   },
   methods: {
-     lastPage() {
+    lastPage() {
       if (this.pageIds.length) {
         const index = this.pageIds.indexOf(this.form.id);
         if (index == 0) {
@@ -1073,19 +1096,19 @@ export default {
         this.$message.warning("请选择对账单位");
         return;
       }
-      if (!this.form.id) {
-        // 是否选择从表数据
-        if (this.handleSelectionData.length == 0) {
-          this.$message.warning("请选择对账数据");
-          return;
-        }
-      }
-      for (let item of this.handleSelectionData) {
-        if (!item.currentStlCurCode) {
-          this.$message.warning("请选择本次结算币种");
-          return;
-        }
-      }
+      // if (!this.form.id) {
+      //   // 是否选择从表数据
+      //   if (this.handleSelectionData.length == 0) {
+      //     this.$message.warning("请选择对账数据");
+      //     return;
+      //   }
+      // }
+      // for (let item of this.handleSelectionData) {
+      //   if (!item.currentStlCurCode) {
+      //     this.$message.warning("请选择本次结算币种");
+      //     return;
+      //   }
+      // }
       this.form.billNoFormat = "HYDZ";
       this.form.businessTypeCode = "HYDZ";
       this.form.businessType = "CHK"; // 对账单
@@ -1098,33 +1121,29 @@ export default {
       this.form.businessDateStart = this.form.businessDateStart ? this.form.businessDateStart.slice(0, 10) + " 00:00:00" : null;
       this.form.billDate = this.form.billDate ? this.form.billDate.slice(0, 10) + " 00:00:00" : null;
       this.form.feeCnName = this.form.feeCnName ? this.form.feeCnName.join(",") : "";
-      if (!this.form.id) {
-        this.form.finStlBillsItemsList = this.handleSelectionData.map((item, index) => {
-          item.lineNo = Number(index) + 1;
-          item.pType = item.businessType;
-          item.accDate = item.billDate;
-          if (item.currentStlCurCode == "CNY") {
-            item.currentStlAmount = item.currentStlAmountRMB;
-          } else {
-            item.currentStlAmount = item.currentStlAmountUSD;
-          }
-          // delete item.businessType
-          if (!this.form.id) {
-            delete item.id;
-          }
-          delete item.accountDc;
-          return item;
-        });
-      } else {
-        this.form.finStlBillsItemsList = this.form.finStlBillsItemsList.map((item, index) => {
-          if (item.currentStlCurCode == "CNY") {
-            item.currentStlAmount = item.currentStlAmountRMB;
-          } else {
-            item.currentStlAmount = item.currentStlAmountUSD;
-          }
-          return item;
-        });
-      }
+      let addList = this.addData.map((item, index) => {
+        item.lineNo = Number(index) + 1;
+        item.pType = item.businessType;
+        item.accDate = item.billDate;
+        if (item.currentStlCurCode == "CNY") {
+          item.currentStlAmount = item.currentStlAmountRMB;
+        } else {
+          item.currentStlAmount = item.currentStlAmountUSD;
+        }
+        delete item.id;
+        delete item.accountDc;
+        return item;
+      });
+
+      this.form.finStlBillsItemsList = this.tableData.concat(addList);
+      this.form.finStlBillsItemsList = this.form.finStlBillsItemsList.map((item, index) => {
+        if (item.currentStlCurCode == "CNY") {
+          item.currentStlAmount = item.currentStlAmountRMB;
+        } else {
+          item.currentStlAmount = item.currentStlAmountUSD;
+        }
+        return item;
+      });
       this.saveLoading = true; // 加载动画
       this.pageLoading = true;
       // 判断是单独点击保存还是点击确认对账
@@ -1133,6 +1152,7 @@ export default {
           .then(res => {
             this.$message.success("操作成功");
             this.$emit(type);
+            this.finstlbillslistAccBillV1fun()
           })
           .finally(() => {
             this.pageLoading = false;
@@ -1143,6 +1163,7 @@ export default {
           .then(res => {
             this.form = res.data.data;
             this.finstlbillsConfirmReconciliationfun();
+            this.finstlbillslistAccBillV1fun()
           })
           .catch(() => {
             this.pageLoading = false;
@@ -1153,6 +1174,7 @@ export default {
           .then(res => {
             this.$message.success("操作成功");
             this.finstlbillsDetailfun(res.data.data.id);
+            this.finstlbillslistAccBillV1fun()
           })
           .finally(() => {
             this.pageLoading = false;
@@ -1283,7 +1305,7 @@ export default {
     },
     // 检索出的弹窗
     finstlbillslistAccBillByCorpfun() {
-      delete this.form.id;
+      // delete this.form.id;
       // let obj = JSON.parse(JSON.stringify(this.form))
       let obj = {};
       obj.type = "1";
@@ -1324,7 +1346,7 @@ export default {
     },
     // 检索接口
     finstlbillslistAccBillV1fun() {
-      delete this.form.id;
+      // delete this.form.id;
       // let obj = JSON.parse(JSON.stringify(this.form))
       let obj = {};
       obj.type = "1";
@@ -1359,7 +1381,7 @@ export default {
       obj.approveTimeEnd = this.form.auditDateTo; // 审核结束日期
       obj.feeCnName = this.form.feeCnName ? this.form.feeCnName.join(",") : "";
       finstlbillslistAccBillV1(obj).then(res => {
-        this.tableData = res.data.data.map((item, index) => {
+        res.data.data.forEach((item, index) => {
           item.accBillId = item.id;
           delete item.id;
           item.lineNo = Number(index) + 1;
@@ -1381,9 +1403,14 @@ export default {
             this.$set(item, "currentStlAmountUSD", Number(item.reconciliationCurrentAmount ? item.reconciliationCurrentAmount : 0));
             this.$set(item, "currentStlAmountRMB", Number(0));
           }
-          return item;
         });
-        if (this.tableData.length == 0) {
+        this.queryData = [];
+        for (let item of res.data.data) {
+          if (this.tableData.filter(row => row.accBillNo == item.accBillNo).length == 0) {
+            this.queryData.push(item);
+          }
+        }
+        if (this.queryData.length == 0) {
           this.$message.warning("当前检索暂无数据!");
         }
       });
@@ -1601,10 +1628,6 @@ export default {
         this.finstlbillsRevokeSignForfun();
       });
     },
-    // 确认选定行
-    SelectedRows() {
-      this.editCustomer();
-    },
     // 一键删除
     batchDeletefun() {
       if (this.handleSelectionData.length == 0) {
@@ -1647,6 +1670,14 @@ export default {
         }
       });
     },
+    // 确认选定行
+    allCell() {
+      this.editCustomer();
+    },
+     // 确认选定行
+    addSelectionChange(arr) {
+      this.addData = arr;
+    },
     // 下面表格多选
     handleSelectionChange(arr) {
       this.handleSelectionData = arr;