zuozhengqing
2024-03-27 b811e2fa4cdcb5949047faa78aa9299aec1d2f67
src/views/purchaseManage/purchase/index.vue
@@ -53,6 +53,13 @@
                  <el-button type="text" size="small" @click="btnLook(scope.row)" style="margin-right: 5px"
                    >查看</el-button
                  >
                  <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 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"
@@ -96,6 +103,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">
@@ -117,6 +134,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>
@@ -125,18 +146,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() {
@@ -155,6 +179,17 @@
    ]
    // 收货信息
    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" },
@@ -162,10 +197,11 @@
      { label: "数量", prop: "amount" },
      { label: "入库时间", prop: "overTime" },
      { label: "收货人", prop: "principal" },
      { label: "状态", prop: "status", isCallMethod: true, getCallMethod: this.getpurchaseStatus }
      { label: "状态", prop: "status", isCallMethod: true, getCallMethod: this.getreceiveStatusStatus }
    ]
    return {
      purchaseStatusList: getDataByType("purchaseStatus"),
      receiveStatusList: getDataByType("receiveStatus"),
      tableLoading: false,
      tableList: {}, // 列表
      selValueList: [],
@@ -184,6 +220,23 @@
          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 },
@@ -197,7 +250,7 @@
      showCol: ["采购单号", "采购单名称", "单据类型", "供应商名称", "采购数量", "收货仓库", "经办人", "制单人"],
      tableBottomColumn: [],
      showBottomCol: [],
      TabsIndex: "0",
      TabsIndex: 0,
      productTableList: {},
      // 产品信息
      productColumn: productColumn,
@@ -215,7 +268,10 @@
      ],
      // 收货信息
      recriveColumn: recriveColumn,
      showReceiveCol: ["入库单号", "收货仓库", "产品名称", "产品编码", "数量", "入库时间", "收货人", "状态"],
      // 入库信息
      inLibraryColumn:inLibraryColumn,
      showReceiveCol: ["收货时间", "收货人", "产品名称", "产品编码", "规格", "数量", "单位", "状态"],
      inLibraryCol: ["入库单号", "收货仓库", "产品名称", "产品编码", "数量", "入库时间", "收货人", "状态"],
      loading: false,
      selectRow: {}
    }
@@ -253,6 +309,17 @@
        for (let i in this.purchaseStatusList) {
          if (this.purchaseStatusList[i].id == val) {
            return this.purchaseStatusList[i].name
          }
        }
      } else {
        return "--"
      }
    },
    getreceiveStatusStatus(val) {
      if (val) {
        for (let i in this.receiveStatusList) {
          if (this.receiveStatusList[i].id == val) {
            return this.receiveStatusList[i].name
          }
        }
      } else {
@@ -302,7 +369,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)
            }
          }
        })
@@ -407,7 +475,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()
@@ -430,7 +501,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()
@@ -491,6 +565,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
@@ -514,7 +599,7 @@
    // top 行点击
    tableRowClick(row) {
      this.selectRow = row
      if (row.status == 1 && this.TabsIndex == 0) {
      if (this.TabsIndex == 0) {
        getPurchaseInfo({ id: row.id }).then((res) => {
          if (res.code == 200) {
            this.productTableList.tableInfomation = res.data.productList
@@ -522,9 +607,18 @@
            this.$message.error(res.msg ? res.msg + "," : "" + "获取信息失败!")
          }
        })
      } else if (this.TabsIndex == 1 && row.status == 1) {
      } else if (this.TabsIndex == 1 ) {
        this.productTableList.tableInfomation = []
      } else {
        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) {
        getOperationInfo({ id: row.id }).then((res) => {
          if (res.code == 200) {
            this.productTableList.tableInfomation = res.data
@@ -532,6 +626,8 @@
            this.$message.error(res.msg ? res.msg + "," : "" + "获取信息失败!")
          }
        })
      }else {
        this.productTableList.tableInfomation=[]
      }
    },
    // bom 列表
@@ -574,16 +670,22 @@
        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) {
      if (this.TabsIndex == 0 ) {
        getPurchaseInfo({ id: row.id }).then((res) => {
          if (res.code == 200) {
            this.productTableList.tableInfomation = res.data.productList
@@ -593,7 +695,17 @@
        })
      } else if (this.TabsIndex == 1 && row.status == 1) {
        this.productTableList.tableInfomation = []
      } else {
      } else if(this.TabsIndex==1 ){
        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){
        getOperationInfo({ id: row.id }).then((res) => {
          if (res.code == 200) {
            this.productTableList.tableInfomation = res.data
@@ -601,6 +713,8 @@
            this.$message.error(res.msg ? res.msg + "," : "" + "获取信息失败!")
          }
        })
      }else{
        this.productTableList.tableInfomation =[]
      }
    }
  }