yangfeng
2024-03-08 60d0884f82141a0127fca7e2b03bf3c147436776
src/views/purchaseManage/purchase/index.vue
@@ -23,6 +23,8 @@
            :table-list="tableList"
            @selCommonClick="selCommonClick"
            @selTableCol="selTableCol"
            @tableRowClick="tableRowClick"
            :selectClassRow="selectRow"
          >
            <template slot="tableButton">
              <el-table-column label="状态" width="120">
@@ -120,7 +122,13 @@
<script>
import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
import { getPurchaseList, getPurchaseInfo, submitPurchase, deletePurchase } from "@/api/purchaseManage/purchase"
import {
  getPurchaseList,
  getPurchaseInfo,
  submitPurchase,
  deletePurchase,
  getOperationInfo
} from "@/api/purchaseManage/purchase"
import DetailSupplier from "@/views/purchaseManage/purchase/DetailSupplier"
import AddPurchase from "@/views/purchaseManage/purchase/components/AddPurchase"
import { getSupplierList } from "@/api/supplierManage/supplier"
@@ -134,12 +142,13 @@
  data() {
    // 产品信息
    const productColumn = [
      { label: "产品编号", prop: "number", default: true },
      { label: "产品名称", prop: "name" },
      { label: "规格型号", prop: "desc" },
      { label: "采购数量", prop: "purchaseAmount" },
      { label: "已发货数量", prop: "margin" },
      { label: "已入库数量", prop: "amount" },
      { label: "产品编号", prop: "productId", default: true },
      { label: "产品名称", prop: "productName" },
      { label: "规格", prop: "specifications" },
      { label: "型号", prop: "modelNumber" },
      { label: "采购数量", prop: "amount" },
      { label: "已发货数量", prop: "sendAmount" },
      { label: "已入库数量", prop: "overAmount" },
      { label: "单位", prop: "unit" },
      { label: "采购单价", prop: "price", price: true },
      { label: "价税合计", prop: "total", price: true }
@@ -147,13 +156,13 @@
    // 收货信息
    const recriveColumn = [
      { label: "入库单号", prop: "number", default: true },
      { label: "收货仓库", prop: "name" },
      { label: "产品名称", prop: "orderAmount" },
      { label: "产品编码", prop: "invoice" },
      { label: "数量", prop: "carrier" },
      { label: "入库时间", prop: "waybill" },
      { label: "收货人", prop: "warehouse" },
      { label: "状态", prop: "amount" }
      { label: "收货仓库", prop: "warehouseName" },
      { label: "产品名称", prop: "productName" },
      { label: "产品编码", prop: "productId" },
      { label: "数量", prop: "amount" },
      { label: "入库时间", prop: "overTime" },
      { label: "收货人", prop: "principal" },
      { label: "状态", prop: "status" }
    ]
    return {
      purchaseStatusList: getDataByType("purchaseStatus"),
@@ -195,7 +204,8 @@
      showProductCol: [
        "产品编号",
        "产品名称",
        "规格型号",
        "规格",
        "型号",
        "采购数量",
        "已发货数量",
        "已入库数量",
@@ -205,8 +215,9 @@
      ],
      // 收货信息
      recriveColumn: recriveColumn,
      showReceiveCol: ["入库单号", "收货仓库", "产品名称", "产品编号", "数量", "入库时间", "收货人", "状态"],
      loading: false
      showReceiveCol: ["入库单号", "收货仓库", "产品名称", "产品编码", "数量", "入库时间", "收货人", "状态"],
      loading: false,
      selectRow: {}
    }
  },
  created() {
@@ -289,6 +300,10 @@
            })
            this.tableList.tableInfomation = list || []
            this.pagerOptions.totalCount = res.data.total
            if (res.data.total > 0) {
              this.selectRow = this.tableList.tableInfomation.length > 0 ? this.tableList.tableInfomation[0] : {}
              this.tableRowClick(this.selectRow)
            }
          }
        })
        .catch((err) => {
@@ -490,6 +505,29 @@
        this.tableLoading = false
      }, 3000)
    },
    // top 行点击
    tableRowClick(row) {
      this.selectRow = row
      if (row.status == 1 && this.TabsIndex == 0) {
        getPurchaseInfo({ id: row.id }).then((res) => {
          if (res.code == 200) {
            this.productTableList.tableInfomation = res.data.productList
          } else {
            this.$message.error(res.msg ? res.msg + "," : "" + "获取信息失败!")
          }
        })
      } else if (this.TabsIndex == 1 && row.status == 1) {
        this.productTableList.tableInfomation = []
      } else {
        getOperationInfo({ id: row.id }).then((res) => {
          if (res.code == 200) {
            this.productTableList.tableInfomation = res.data
          } else {
            this.$message.error(res.msg ? res.msg + "," : "" + "获取信息失败!")
          }
        })
      }
    },
    // bom 列表
    setBottomList() {
      this.productTableList = {
@@ -529,11 +567,7 @@
        this.tableBottomColumn = this.recriveColumn
        this.showBottomCol = this.showReceiveCol
        this.setBottomList()
        // if (this.selectRow.status == 1) {
        //   this.productTableList.tableInfomation = []
        // } else {
        this.getProductInventoryInfo(this.selectRow)
        // }
      }
    },
    // 状态
@@ -543,22 +577,25 @@
    // 获取产品/收货信息
    async getProductInventoryInfo(row) {
      console.log(row)
      // if (this.TabsIndex == 0 || row.status == 1) {
      //   this.productTableList.tableInfomation = row.products || []
      // } else {
      //   if (row.number) {
      //     this.loading = true
      //     await getProductInventoryInfo(row.number)
      //       .then((res) => {
      //         this.productTableList.tableInfomation = res.data?.length > 0 ? res.data : []
      //         this.loading = false
      //       })
      //       .catch(() => {
      //         this.productTableList.tableInfomation = []
      //         this.loading = false
      //       })
      //   }
      // }
      if (this.TabsIndex == 0 && row.status == 1) {
        getPurchaseInfo({ id: row.id }).then((res) => {
          if (res.code == 200) {
            this.productTableList.tableInfomation = res.data.productList
          } else {
            this.$message.error(res.msg ? res.msg + "," : "" + "获取信息失败!")
          }
        })
      } else if (this.TabsIndex == 1 && row.status == 1) {
        this.productTableList.tableInfomation = []
      } else {
        getOperationInfo({ id: row.id }).then((res) => {
          if (res.code == 200) {
            this.productTableList.tableInfomation = res.data
          } else {
            this.$message.error(res.msg ? res.msg + "," : "" + "获取信息失败!")
          }
        })
      }
    }
  }
}