yangfeng
2023-11-16 185acb9f9f73c1818b9eb2dcb783c30d2174381f
优化产品选择组件
3个文件已修改
96 ■■■■■ 已修改文件
src/components/makepager/CommonFormTableView.vue 90 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productManage/reorderRules/index.vue 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/warehouseManage/listingRules/index.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/makepager/CommonFormTableView.vue
@@ -274,7 +274,11 @@
                      :echoName="scope.row[item.prop]"
                      checkedNum="1"
                      :clearable="true"
                      @select-user="selProductClick"
                      @select-user="
                        (val) => {
                          selProductClick(val, scope.row)
                        }
                      "
                    >
                    </SimpleSearchInput>
                  </template>
@@ -288,30 +292,6 @@
              >
                <div class="custom-name">
                  <span v-if="scope.row.isEdit || scope.row.editable">{{ scope.row.productCategory }}</span>
                  <!-- <el-select
                    v-else
                    v-model="scope.row[item.prop]"
                    placeholder="请选择"
                    size="mini"
                    style="width: 80%"
                    @change="
                      (val) => {
                        selProductTypeClick(val)
                      }
                    "
                  >
                    <el-option
                      v-for="item in productTypeNameOptions"
                      :key="item.id"
                      :label="item.name"
                      :value="{
                        value: item.id,
                        label: item.name
                      }"
                    >
                    </el-option>
                  </el-select> -->
                  <el-autocomplete
                    v-else
                    style="width: 100%"
@@ -673,14 +653,16 @@
      })
    },
    // 选择产品
    selProductClick(item) {
    selProductClick(item, row) {
      if (this.isReorder) {
        this.productId = item.id
        this.productName = item.name
        this.getAmountAndPrediction(item, "product")
        this.getAmountAndPrediction(item, "product", row)
      } else {
        let selIndex = 0
        this.tableList.tableData.map((ite, index) => {
          if (index === 0) {
          if (ite.id === row.id) {
            selIndex = index
            ite.productId = item.id
            ite.productName = item.name
            ite.categoryId = item.categoryId
@@ -689,7 +671,7 @@
            ite.unit = item.unit
          }
        })
        this.$emit("selProductClick", "product", this.tableList.tableData[0])
        this.$emit("selProductClick", "product", this.tableList.tableData[selIndex])
      }
      if (this.isinventory) {
@@ -697,7 +679,6 @@
          locationId: 0,
          productId: item.value
        }).then((res) => {
          console.log(res)
          if (res.code === 200) {
            const list = res.data ? res.data : []
            this.selLocationOptions = list.locationList
@@ -705,7 +686,6 @@
          }
        })
      }
      console.log(this.tableList.tableData)
      // this.$emit("selProductClick", item)
    },
    // 选择产品类型
@@ -737,9 +717,7 @@
    },
    // 选择位置
    selLocationClick(item, prop, row) {
      console.log(item, prop, row, "起始位置")
      if (prop === "areaName") {
        // this.initialPosition=item.label
        getLocationList({
          jointName: item.label,
          page: 1,
@@ -748,16 +726,13 @@
          if (res.code === 200) {
            const list = res.data ? res.data : []
            this.selSonLocationOptions = list
            if (this.isReorder) {
              this.locacionName = list[0]?.name
              this.locacionId = list[0]?.id
              this.$emit("selLocationClick", list[0], "locacionName")
            }
          }
        })
      }
      if (this.isReorder) {
        if (this.productId !== 0) {
        this.locacionId = item.value
        this.productId = row.productId
        if (this.productId.length !== 0) {
          this.getAmountAndPrediction(row, "location", item)
        }
      }
@@ -780,26 +755,33 @@
    },
    // 获取在库与预测数量
    getAmountAndPrediction(item, val, ite) {
      console.log(item, val, ite)
      if (this.productName.length > 0) {
        getAmountAndPrediction({
          locationId: val === "product" ? this.locacionId : ite.value,
          productId: val === "product" ? item.value : this.productId
        }).then((res) => {
          if (res.code === 200) {
            this.tableList.tableData.map((ite, index) => {
              if (index == 0) {
      let selIndex = 0
      getAmountAndPrediction({
        locationId: val === "product" ? this.locacionId : ite.value,
        productId: val === "product" ? item.id : this.productId
      }).then((res) => {
        if (res.code === 200) {
          this.tableList.tableData.map((ite, index) => {
            if (val === "product") {
              if (index === 0) {
                selIndex = index
                ite.amount = res.data.amount
                ite.prediction = res.data.prediction
                ite.productId = item.id
                ite.productName = item.name
                ite.unit = item.unit
              }
            })
            this.$emit("selProductClick", this.tableList.tableData[0])
          }
        })
      }
            } else {
              if (ite.id === item.id) {
                selIndex = index
                ite.amount = res.data.amount
                ite.prediction = res.data.prediction
              }
            }
          })
          this.$emit("selProductClick", this.tableList.tableData[selIndex])
        }
      })
    },
    // 选择路线
    selRouteClick(item, prop) {
@@ -849,7 +831,6 @@
      this.$emit("addProductClick")
    },
    commonInputChange(val, prop, row) {
      console.log(val, prop)
      this.$emit("inputContent", val, prop, row)
    },
    // 清空
@@ -891,6 +872,7 @@
    },
    // 行点击
    tableRowClick(row) {
      this.locacionName = row.location.name
      this.$emit("tableRowClick", row, row.index)
    },
    // 单选行相关
src/views/productManage/reorderRules/index.vue
@@ -92,7 +92,6 @@
      this.pagerOptions.currPage = 1
      this.searchTaskMap =
        query.productId?.length > 0 ? [{ productId: this.queryProductId, title: query.productName }] : []
      console.log(this.searchTaskMap)
    }
    this.getData()
  },
@@ -123,7 +122,6 @@
        pageSize: this.pagerOptions.pageSize
      }).then((res) => {
        if (res.code === 200) {
          console.log(res)
          const list = res.data.map((item) => {
            let orderNum = 0
            if (parseFloat(item.minInventory) - parseFloat(item.prediction) > 0) {
@@ -182,7 +180,6 @@
    },
    // 新增
    addProductClick() {
      console.log(this.addTitle)
      this.isSel()
      if (this.isNoProduct && this.addTitle === "新建") {
        this.$refs.tablelistRef.getProductList()
@@ -292,7 +289,7 @@
        this.tableData.map((item, index) => {
          if (index === rowIndex) {
            item.isEdit = false
            item.editable = false
            item.editable = true
            item.isOrder = true
          } else {
            item.isEdit = true
src/views/warehouseManage/listingRules/index.vue
@@ -90,7 +90,6 @@
    this.setTable()
    let query = this.$route.query
    if (query) {
      console.log("aaaaaaaaaaaaa", query)
      this.queryProductId = query.productId?.length ? query.productId : null
      this.categoryId = query.id ? Number(query.id) : null
      this.pagerOptions.currPage = 1