src/views/purchaseManage/purchase/index.vue
@@ -9,7 +9,7 @@
          :show-download="false"
          :amount-view="false"
          :show-action-btn="false"
          :placeholder="'请输入供应商名称/物料名称/采购单名称'"
          :placeholder="'请输入供应商名称/物料名称/采购单名称/采购单号等..'"
          @searchClick="onFilterSearch"
        />
      </div>
@@ -53,12 +53,22 @@
                  <el-button type="text" size="small" @click="btnLook(scope.row)" style="margin-right: 5px"
                    >查看</el-button
                  >
                  <!-- <el-button type="text" size="small" @click="btnLook(scope.row)" style="margin-right: 5px"
                  <el-button
                    v-if="scope.row.status === 6 || scope.row.status === 7"
                    type="text"
                    size="small"
                    @click="confirmation(scope.row)"
                    style="margin-right: 5px"
                    >到货确认</el-button
                  >
                  <el-button type="text" size="small" @click="btnLook(scope.row)" style="margin-right: 5px"
                  <el-button
                    v-if="scope.row.status === 7 || scope.row.status === 8"
                    type="text"
                    size="small"
                    @click="TestingAllClick(scope.row)"
                    style="margin-right: 5px"
                    >去质检</el-button
                  > -->
                  >
                  <el-button
                    v-if="scope.row.status === 1"
                    type="text"
@@ -102,6 +112,16 @@
          >
            收货信息
          </div>
          <div
            class="tab-pane"
            @click="getTab(2)"
            :style="{
              background: TabsIndex == 2 ? '#2a78fb' : '#F1F3F8',
              color: TabsIndex == 2 ? '#fff' : '#666'
            }"
          >
            入库信息
          </div>
        </div>
        <div class="list-view">
          <TableCommonView :loading="loading" :table-list="productTableList" @selTableCol="selBottomTableCol">
@@ -123,6 +143,10 @@
    <DetailSupplier v-if="commonDetail.visible" :common-detail="commonDetail" />
    <!-- 新建/编辑 -->
    <AddPurchase ref="addDialog" v-if="editConfig.visible" :edit-common-config="editConfig" />
    <!-- 到货通知 -->
    <ArrivalConfirmation v-if="editAffirmConfig.visible" :edit-common-config="editAffirmConfig" />
    <!-- 批量质检 -->
    <TestingAll v-if="editTestingAllConfig.visible" :edit-common-config="editTestingAllConfig" />
  </div>
</template>
@@ -131,18 +155,21 @@
import {
  getPurchaseList,
  getPurchaseInfo,
  submitPurchase,
  newSubmitPurchase,
  deletePurchase,
  getPurchaseQualityInspectionInfo,
  getOperationInfo
} from "@/api/purchaseManage/purchase"
import DetailSupplier from "@/views/purchaseManage/purchase/DetailSupplier"
import AddPurchase from "@/views/purchaseManage/purchase/components/AddPurchase"
import ArrivalConfirmation from "@/views/purchaseManage/purchase/components/ArrivalConfirmation"
import TestingAll from "@/views/purchaseManage/purchase/components/TestingAll"
import { getSupplierList } from "@/api/supplierManage/supplier"
import { getDataByType } from "@/api/data"
export default {
  name: "SupplierManage",
  props: {},
  components: { DetailSupplier, AddPurchase },
  components: { DetailSupplier, AddPurchase, ArrivalConfirmation, TestingAll },
  mixins: [pageMixin],
  computed: {},
  data() {
@@ -153,7 +180,7 @@
      { label: "规格", prop: "specifications" },
      { label: "型号", prop: "modelNumber" },
      { label: "采购数量", prop: "amount" },
      { label: "已发货数量", prop: "sendAmount" },
      { label: "已收货数量", prop: "sendAmount" },
      { label: "已入库数量", prop: "overAmount" },
      { label: "单位", prop: "unit" },
      { label: "采购单价", prop: "purchasePrice", price: true },
@@ -161,14 +188,25 @@
    ]
    // 收货信息
    const recriveColumn = [
      { label: "收货时间", prop: "createTime", default: true },
      { label: "收货人", prop: "principal" },
      { label: "产品名称", prop: "productName" },
      { label: "产品编码", prop: "productId" },
      { label: "规格", prop: "specs" },
      { label: "数量", prop: "amount" },
      { label: "单位", prop: "unit" },
      { label: "状态", prop: "status", isCallMethod: true, getCallMethod: this.getreceiveStatusStatus }
    ]
    // 入库信息
    const inLibraryColumn = [
      { label: "入库单号", prop: "operationNumber", default: true },
      { label: "收货仓库", prop: "warehouseName" },
      { label: "产品名称", prop: "name" },
      { label: "产品编码", prop: "number" },
      { label: "数量", prop: "amount" },
      { label: "数量", prop: "overAmount" },
      { label: "入库时间", prop: "overTime" },
      { label: "收货人", prop: "principal" },
      { label: "状态", prop: "status", isCallMethod: true, getCallMethod: this.getreceiveStatusStatus }
      { label: "状态", prop: "status", isCallMethod: true, getCallMethod: this.getWarehouseStatus }
    ]
    return {
      purchaseStatusList: getDataByType("purchaseStatus"),
@@ -191,9 +229,24 @@
          supplierList: []
        }
      },
      editAffirmConfig: {
        visible: false,
        isDisabled: false,
        detailEnter: false,
        infomation: {
          // supplierList: []
        }
      },
      editTestingAllConfig: {
        visible: false,
        isDisabled: false,
        detailEnter: false,
        infomation: {}
      },
      tableColumn: [
        { label: "单据类型", prop: "orderType", min: 130 },
        { label: "采购单号", prop: "number", min: 150, isCommonClick: true, default: true },
        { label: "销售明细单", prop: "sourceOrder", min: 130 },
        { label: "采购单名称", prop: "name", min: 130, isCommonClick: true },
        { label: "供应商名称", prop: "supplierName", min: 130 },
        { label: "采购数量", prop: "quantity", min: 130 },
@@ -201,10 +254,10 @@
        { label: "经办人", prop: "handledBy", min: 130 },
        { label: "制单人", prop: "creator", min: 130 }
      ],
      showCol: ["采购单号", "采购单名称", "单据类型", "供应商名称", "采购数量", "收货仓库", "经办人", "制单人"],
      showCol: ["采购单号","销售明细单", "采购单名称", "单据类型", "供应商名称", "采购数量", "收货仓库", "经办人", "制单人"],
      tableBottomColumn: [],
      showBottomCol: [],
      TabsIndex: "0",
      TabsIndex: 0,
      productTableList: {},
      // 产品信息
      productColumn: productColumn,
@@ -214,7 +267,7 @@
        "规格",
        "型号",
        "采购数量",
        "已发货数量",
        "已收货数量",
        "已入库数量",
        "单位",
        "采购单价",
@@ -222,7 +275,10 @@
      ],
      // 收货信息
      recriveColumn: recriveColumn,
      showReceiveCol: ["入库单号", "收货仓库", "产品名称", "产品编码", "数量", "入库时间", "收货人", "状态"],
      // 入库信息
      inLibraryColumn: inLibraryColumn,
      showReceiveCol: ["收货时间", "收货人", "产品名称", "产品编码", "规格", "数量", "单位", "状态"],
      inLibraryCol: ["入库单号", "收货仓库", "产品名称", "产品编码", "数量", "入库时间", "收货人", "状态"],
      loading: false,
      selectRow: {}
    }
@@ -320,7 +376,8 @@
            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)
              // this.tableRowClick(this.selectRow)
              this.getProductInventoryInfo(this.selectRow)
            }
          }
        })
@@ -425,7 +482,10 @@
          if (!row.supplierName) {
            this.btnEdit(row)
          } else {
            submitPurchase({ id: Number(row.id), status: 2 }).then((response) => {
            newSubmitPurchase({
              id: Number(row.id),
              status: 4
            }).then((response) => {
              if (response.code === 200) {
                this.$message.success("提交成功")
                this.getData()
@@ -448,7 +508,10 @@
        type: "warning"
      }).then(
        () => {
          submitPurchase({ id: Number(row.id), status: 5 }).then((response) => {
          newSubmitPurchase({
            id: Number(row.id),
            status: 5
          }).then((response) => {
            if (response.code === 200) {
              this.$message.success("已取消")
              this.getData()
@@ -509,6 +572,17 @@
        this.tableLoading = false
      }, 3000)
    },
    // 到货确认
    confirmation(row) {
      console.log(row, "row")
      this.editAffirmConfig.infomation = row
      this.editAffirmConfig.visible = true
    },
    // 去质检
    TestingAllClick(row) {
      this.editTestingAllConfig.infomation = row
      this.editTestingAllConfig.visible = true
    },
    // 详情
    selCommonClick(row) {
      this.tableLoading = true
@@ -532,24 +606,44 @@
    // top 行点击
    tableRowClick(row) {
      this.selectRow = row
      if (row.status == 1 && this.TabsIndex == 0) {
        getPurchaseInfo({ id: row.id }).then((res) => {
      if (this.TabsIndex == 0) {
        getOperationInfo({ id: row.id }).then((res) => {
          if (res.code == 200) {
            this.productTableList.tableInfomation = res.data.productList
            this.productTableList.tableInfomation = res.data.productInfos
          } else {
            this.$message.error(res.msg ? res.msg + "," : "" + "获取信息失败!")
          }
        })
      } else if (this.TabsIndex == 1 && row.status == 1) {
      } else if (
        (this.TabsIndex == 1 && row.status == 7) ||
        row.status == 8 ||
        (this.TabsIndex == 1 && row.status == 2) ||
        (this.TabsIndex == 1 && row.status == 3)
      ) {
        this.productTableList.tableInfomation = []
      } else {
        getOperationInfo({ id: row.id }).then((res) => {
        getPurchaseQualityInspectionInfo({
          purchaseNumber: row.number
        }).then((res) => {
          if (res.code == 200) {
            this.productTableList.tableInfomation = res.data
          } else {
            this.$message.error(res.msg ? res.msg + "," : "" + "获取信息失败!")
          }
        })
      } else if (
        (this.TabsIndex == 2 && row.status == 8) ||
        (this.TabsIndex == 2 && row.status == 2) ||
        (this.TabsIndex == 2 && row.status == 3)
      ) {
        getOperationInfo({ id: row.id }).then((res) => {
          if (res.code == 200) {
            this.productTableList.tableInfomation = res.data.inWarehouseInfos
          } else {
            this.$message.error(res.msg ? res.msg + "," : "" + "获取信息失败!")
          }
        })
      } else {
        this.productTableList.tableInfomation = []
      }
    },
    // bom 列表
@@ -592,34 +686,88 @@
        this.showBottomCol = this.showReceiveCol
        this.setBottomList()
        this.getProductInventoryInfo(this.selectRow)
      } else if (this.TabsIndex == 2) {
        console.log("入库")
        // 入库信息列表
        this.tableBottomColumn = this.inLibraryColumn
        this.showBottomCol = this.inLibraryCol
        this.setBottomList()
        this.getProductInventoryInfo(this.selectRow)
      }
    },
    // 状态
    getStatus(val) {
      return val === 1 ? "待确认" : val === 2 ? "待出库" : val === 3 ? "出库完成" : val === 4 ? "已关闭" : "--"
      return val === 1
        ? "待确认"
        : val === 2
        ? "待入库"
        : val === 3
        ? "已入库"
        : val === 4
        ? "已完成"
        : val === 5
        ? "已取消"
        : val === 6
        ? "待收货"
        : val === 7
        ? "部分收货"
        : val === 8
        ? "待质检"
        : "--"
    },
    // 获取产品/收货信息
    async getProductInventoryInfo(row) {
      console.log(row)
      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) {
      // if (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) => {
      } else if (
        (this.TabsIndex == 1 && row.status == 7) ||
        (this.TabsIndex == 1 && row.status == 8) ||
        (this.TabsIndex == 1 && row.status == 2) ||
        (this.TabsIndex == 1 && row.status == 3)
      ) {
        getPurchaseQualityInspectionInfo({
          purchaseNumber: row.number
        }).then((res) => {
          if (res.code == 200) {
            this.productTableList.tableInfomation = res.data
          } else {
            this.$message.error(res.msg ? res.msg + "," : "" + "获取信息失败!")
          }
        })
      } else if (
        this.TabsIndex == 0 ||
        (this.TabsIndex == 2 && row.status == 8) ||
        (this.TabsIndex == 2 && row.status == 2) ||
        (this.TabsIndex == 2 && row.status == 3)
      ) {
        getOperationInfo({ id: row.id }).then((res) => {
          if (res.code == 200) {
            if(this.TabsIndex == 0){
              this.productTableList.tableInfomation = res.data.productInfos
            }else if(this.TabsIndex == 2){
              this.productTableList.tableInfomation = res.data.inWarehouseInfos
            }
          } else {
            this.$message.error(res.msg ? res.msg + "," : "" + "获取信息失败!")
          }
        })
      } else {
        this.productTableList.tableInfomation = []
      }
    },
    // 入库状态
    getWarehouseStatus(val) {
      let newVal = Number(val)
      return newVal === 1 ? "草稿" : newVal === 3 ? "就绪" : newVal === 4 ? "完成" : newVal === 5 ? "已取消" : " "
    }
  }
}