zuozhengqing
2024-03-23 4eec87aecfa3c7aa9a1ef8d268aeecda037b98d0
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: [],
@@ -182,6 +218,23 @@
        detailEnter: false,
        infomation: {
          supplierList: []
        }
      },
      editAffirmConfig: {
        visible: false,
        isDisabled: false,
        detailEnter: false,
        infomation: {
          // supplierList: []
        }
      },
      editTestingAllConfig:{
        visible: false,
        isDisabled: false,
        detailEnter: false,
        infomation: {
        }
      },
      tableColumn: [
@@ -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 {
@@ -381,8 +448,7 @@
          this.editConfig.infomation = {
            productList: res.data.productList,
            supplierName: res.data.purchase.supplier.name,
            ...res.data.purchase,
            purchaseTypeId: res.data.purchase.purchaseTypeId == "0" ? "" : res.data.purchase.purchaseTypeId
            ...res.data.purchase
          }
        } else {
          this.$message.error(res.msg ? res.msg + "," : "" + "获取信息失败!")
@@ -391,9 +457,8 @@
      setTimeout(() => {
        this.tableLoading = false
      }, 3000)
      // this.editRow = row;
      // this.$refs.add.islook = true;
    },
    // 确认发货
    btnConfirm(row) {
      let string = "是否提交?"
@@ -409,7 +474,7 @@
          if (!row.supplierName) {
            this.btnEdit(row)
          } else {
            submitPurchase({ id: Number(row.id), status: 2 }).then((response) => {
            newSubmitPurchase(row.id).then((response) => {
              if (response.code === 200) {
                this.$message.success("提交成功")
                this.getData()
@@ -432,7 +497,7 @@
        type: "warning"
      }).then(
        () => {
          submitPurchase({ id: Number(row.id), status: 5 }).then((response) => {
          newSubmitPurchase(Number(row.id)).then((response) => {
            if (response.code === 200) {
              this.$message.success("已取消")
              this.getData()
@@ -483,8 +548,7 @@
          this.editConfig.infomation = {
            productList: res.data.productList,
            supplierName: res.data.purchase.supplier.name,
            ...res.data.purchase,
            purchaseTypeId: res.data.purchase.purchaseTypeId == "0" ? "" : res.data.purchase.purchaseTypeId
            ...res.data.purchase
          }
        } else {
          this.$message.error(res.msg ? res.msg + "," : "" + "获取信息失败!")
@@ -493,6 +557,17 @@
      setTimeout(() => {
        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) {
@@ -525,9 +600,18 @@
            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.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
@@ -535,6 +619,8 @@
            this.$message.error(res.msg ? res.msg + "," : "" + "获取信息失败!")
          }
        })
      }else {
        this.productTableList.tableInfomation=[]
      }
    },
    // bom 列表
@@ -577,15 +663,20 @@
        this.showBottomCol = this.showReceiveCol
        this.setBottomList()
        this.getProductInventoryInfo(this.selectRow)
      } else if (this.TabsIndex == 2) {
        // 入库信息列表
        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) {
@@ -596,7 +687,17 @@
        })
      } else if (this.TabsIndex == 1 && row.status == 1) {
        this.productTableList.tableInfomation = []
      } else {
      } else if(this.TabsIndex==1 && row.status==7||row.status==8){
        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
@@ -604,6 +705,8 @@
            this.$message.error(res.msg ? res.msg + "," : "" + "获取信息失败!")
          }
        })
      }else{
        this.productTableList.tableInfomation =[]
      }
    }
  }