yangfeng
2023-09-27 496ab649c883f9be20fa982da9918889cdd18282
src/components/makepager/CommonFormTableView.vue
@@ -154,8 +154,8 @@
                    "
                  >
                    <el-option
                      v-for="item in selLocationOptions"
                      :key="item.id"
                      v-for="(item, index) in selLocationOptions"
                      :key="index"
                      :label="item.name"
                      :value="{ value: item.id, label: item.name }"
                    >
@@ -249,6 +249,7 @@
import { getProductList } from "@/api/product/product"
import { getLocationList } from "@/api/warehouseManage/warehouse"
import { getCompanyList } from "@/api/common/other"
import { getRuleList } from "@/api/operate/inventoryAdjustment"
// import SelectCommonDialog from "@/views/other/commonDialog/SelectCommonDialog"
export default {
  name: "CommmonFormTableView",
@@ -307,9 +308,10 @@
    }
  },
  created() {
    this.getProductList()
    if (this.isinventory) {
      this.getLocationList()
      this.getRuleList()
    } else {
      this.getProductList()
    }
    if (this.islistingrules) {
      this.getLocationList()
@@ -335,6 +337,20 @@
          if (res.data && res.data.length > 0) {
            this.productNameOptions = res.data
          }
        }
      })
    },
    // 库存调整获取位置和产品
    async getRuleList() {
      await getRuleList({
        locationId: 0,
        productId: ""
      }).then((res) => {
        console.log(res)
        if (res.code === 200) {
          const list = res.data ? res.data : []
          this.selLocationOptions = list.locationList
          this.productNameOptions = list.productList
        }
      })
    },
@@ -384,6 +400,18 @@
          ite.unit = item.unit
        }
      })
      if (this.isinventory) {
        getRuleList({
          locationId: 0,
          productId: item.value
        }).then((res) => {
          console.log(res)
          if (res.code === 200) {
            const list = res.data ? res.data : []
            this.selLocationOptions = list.locationList
          }
        })
      }
      console.log(this.tableList.tableData)
      this.$emit("selProductClick", item)
    },
@@ -391,6 +419,19 @@
    selLocationClick(item, prop) {
      console.log(item)
      console.log(this.tableList.tableData)
      if (this.isinventory) {
        getRuleList({
          locationId: item.value,
          productId: ""
        }).then((res) => {
          console.log(res)
          if (res.code === 200) {
            const list = res.data ? res.data : []
            // this.selLocationOptions = list.locationList
            this.productNameOptions = list.productList
          }
        })
      }
      this.$emit("selLocationClick", item, prop)
    },
    // 选择单位/用户