yangfeng
2023-11-03 47121dff8da689923f2f1af9daf63854f385c395
查看产品、产品类别弹窗调整上架规则
4个文件已修改
136 ■■■■ 已修改文件
src/views/productManage/product/AddProductDialog.vue 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productManage/product/index.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productManage/productCategory/AddProductCategoryDialog.vue 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/warehouseManage/listingRules/index.vue 45 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productManage/product/AddProductDialog.vue
@@ -43,6 +43,7 @@
            :show-procure="showProcure"
            :countObject="statisticsMap"
            :show-sale="showSale"
            @listingRulesClick="listingRulesClick"
          />
          <div class="bottom">
            <el-tabs v-model="activeName" type="card">
@@ -559,19 +560,21 @@
     * 非必填项后端返回的是数字 0,表单需要空串才能视为未选择回显
     */
    setOptionalFieldsToEmpty(){
      ['productType','categoryId']
          .filter(filed => this.editConfig.infomation[filed] === 0)
          .forEach(filed => {
            this.editConfig.infomation[filed] = ''
      let arr = ["productType", "categoryId"]
      arr
        .filter((filed) => this.editConfig.infomation[filed] === 0)
        .forEach((filed) => {
          this.editConfig.infomation[filed] = ""
          })
    },
    /**
     * 后端只接受数字形式, 保存时还得再转回去
     */
    unsetFieldsToNumber(){
      ['productType','categoryId']
          .filter(filed => this.editConfig.infomation[filed] === '')
          .forEach(filed => {
      let arr = ["productType", "categoryId"]
      arr
        .filter((filed) => this.editConfig.infomation[filed] === "")
        .forEach((filed) => {
            this.editConfig.infomation[filed] = 0
          })
    },
@@ -779,6 +782,20 @@
        })
      }
    },
    // 上架规则
    listingRulesClick() {
      this.$refs.form.validate((valid) => {
        if (valid) {
          this.$router.push({
            path: "/warehouseManage/listingRules",
            query: {
              productName: this.editConfig.infomation.name,
              productId: this.editConfig.title === "新建" ? "" : this.editConfig.infomation.id
            }
          })
        }
      })
    },
    // 可销售/可采购
    checkboxChange(val, param) {
      if (val === "采购") {
src/views/productManage/product/index.vue
@@ -125,7 +125,6 @@
      this.pagerOptions.currPage = 1
      this.searchTaskMap = query.id ? [{ categoryId: this.categoryId, title: query.categoryName }] : []
    }
    this.getData()
  },
  methods: {
src/views/productManage/productCategory/AddProductCategoryDialog.vue
@@ -38,7 +38,12 @@
        size="mini"
      >
        <div class="basic-info">
          <FormBtnsView :showProduct="true" :countObject="statisticsMap" @productClick="productClick" />
          <FormBtnsView
            :showProduct="true"
            :countObject="statisticsMap"
            @productClick="productClick"
            @listingRulesClick="listingRulesClick"
          />
          <div class="basic-info-view">
            <!-- <el-row> -->
            <!-- <el-col :span="24">
@@ -173,7 +178,7 @@
import { addProductCategory, updateProductCategory, deleteProductCategory } from "@/api/product/productCategory"
import { getDataByType } from "@/api/data"
import {getProductList} from "@/api/product/product";
import { getProductList } from "@/api/product/product"
export default {
  name: "AddProductCategoryDialog",
  props: {
@@ -184,7 +189,7 @@
          visible: false,
          title: "新建",
          infomation: { type: [] },
          autoEdit: false,
          autoEdit: false
        }
      }
    },
@@ -198,12 +203,12 @@
  components: {},
  computed: {
    modalTitle(){
      if (this.editConfig.title === '编辑' && this.editConfig.autoEdit){
        return '编辑'
      }else if (this.editConfig.title === '编辑') {
        return !this.showEdit ? '编辑' : '查看'
      if (this.editConfig.title === "编辑" && this.editConfig.autoEdit) {
        return "编辑"
      } else if (this.editConfig.title === "编辑") {
        return !this.showEdit ? "编辑" : "查看"
      }else {
        return '新建'
        return "新建"
      }
    }
  },
@@ -243,36 +248,40 @@
     * 非必填项后端返回的是数字 0,表单需要空串才能视为未选择回显
     */
    setOptionalFieldsToEmpty(){
      ['parentId','costingMethod','inventoryValuation','forceRemovalStrategy']
          .filter(filed => this.editConfig.infomation[filed] === 0)
          .forEach(filed => {
            this.editConfig.infomation[filed] = ''
      let arr = ["parentId", "costingMethod", "inventoryValuation", "forceRemovalStrategy"]
      arr
        .filter((filed) => this.editConfig.infomation[filed] === 0)
        .forEach((filed) => {
          this.editConfig.infomation[filed] = ""
          })
    },
    /**
     * 后端只接受数字形式, 保存时还得再转回去
     */
    unsetFieldsToNumber(){
      ['parentId','costingMethod','inventoryValuation','forceRemovalStrategy']
          .filter(filed => this.editConfig.infomation[filed] === '')
          .forEach(filed => {
      let arr = ["parentId", "costingMethod", "inventoryValuation", "forceRemovalStrategy"]
      arr
        .filter((filed) => this.editConfig.infomation[filed] === "")
        .forEach((filed) => {
            this.editConfig.infomation[filed] = 0
          })
    },
    // 获取产品数量
    getProductCount(){
      getProductList({
        keyWord: '',
        keyWord: "",
        categoryId: this.editConfig.title === "新建" ? null : this.editConfig.infomation.id,
        page: 1,
        pageSize: 1
      }).then((res) => {
      })
        .then((res) => {
        if (res.code === 200) {
          this.statisticsMap.product = res?.total ?? 0
        }else{
          this.statisticsMap.product = 0
        }
      }).catch(err=>{
        })
        .catch((err) => {
        console.error(err)
        this.statisticsMap.product = 0
      })
@@ -374,6 +383,20 @@
          })
        }
      })
    },
    // 上架规则
    listingRulesClick() {
      this.$refs.form.validate((valid) => {
        if (valid) {
          this.$router.push({
            path: "/warehouseManage/listingRules",
            query: {
              categoryName: this.editConfig.infomation.name,
              id: this.editConfig.title === "新建" ? "" : this.editConfig.infomation.id
            }
          })
        }
      })
    }
  }
}
src/views/warehouseManage/listingRules/index.vue
@@ -4,12 +4,14 @@
      <SearchCommonView
        :add-title="addTitle"
        :show-discard="showDiscard"
        :placeholder="'请输入位置/产品'"
        :placeholder="'请输入产品/产品类别'"
        :amount-view="false"
        :search-task-map="searchTaskMap"
        @addCommonClick="addProductClick"
        @searchClick="getList"
        @discardBtnClick="discardBtnClick"
        @applyBtnClick="applyBtnClick"
        @delSelectClick="delSelectClick"
      />
    </div>
    <div class="list-view">
@@ -94,10 +96,27 @@
      currentRowId: 0,
      rowIndex:-1,
      RuleType:0,
      queryProductId: null,
      categoryId: null,
      searchTaskMap: []
    }
  },
  created() {
    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
      this.searchTaskMap =
        query?.id > 0
          ? [{ categoryId: this.categoryId, title: query.categoryName }]
          : query.productId?.length > 0
          ? [{ productId: this.queryProductId, title: query.productName }]
          : []
      console.log(this.searchTaskMap)
    }
    this.getData()
  },
  methods: {
@@ -118,7 +137,8 @@
    // 请求数据
    async getData() {
      await getListingRulesList({
        // keyword: this.keyword,
        productId: this.queryProductId ? this.queryProductId : null,
        productCategoryId: this.categoryId ? this.categoryId : null,
        page: this.pagerOptions.currPage,
        pageSize: this.pagerOptions.pageSize
      }).then((res) => {
@@ -181,7 +201,7 @@
      } else {
        if (this.areaId === 0) {
          this.$message.error("请选择当前产品到达位置")
        } else if (this.productId === 0 && this.productCategoryId==='') {
        } else if (this.productId === 0 && this.productCategoryId === "") {
          this.$message.error("请选择产品或产品类别")
        } else if (this.subLocationId === 0) {
          this.$message.error("请选择存储到子位置")
@@ -204,8 +224,8 @@
              id: this.currentRowId,
              areaId: this.areaId,
              locationId: this.subLocationId,
              productCategoryId: this.productCategoryId||'',
              productId: this.productId||''
            productCategoryId: this.productCategoryId || "",
            productId: this.productId || ""
          }).then((res) => {
            console.log(res)
            if (res.code === 200) {
@@ -300,7 +320,10 @@
        this.subLocationId = row.locationId
        this.productCategoryId = row.productCategoryId
        this.productId = row.productId
        if(this.tableList.tableData[rowIndex].productName===""||this.tableList.tableData[rowIndex].productName===" "){
        if (
          this.tableList.tableData[rowIndex].productName === "" ||
          this.tableList.tableData[rowIndex].productName === " "
        ) {
          this.tableList.tableColumn[1].product=false
          this.tableList.tableColumn[2].productType=true
        }else{
@@ -356,8 +379,8 @@
        this.productCategoryId=item.value
      }else{
        this.tableList.tableColumn[1].product=false
        this.tableList.tableData[this.rowIndex].productName=' '
        this.productId=''
        this.tableList.tableData[this.rowIndex].productName = " "
        this.productId = ""
        this.productCategoryId=this.tableList.tableData[this.rowIndex].productCategoryId
      }
    },
@@ -370,6 +393,12 @@
          this.getData()
        }
      })
    },
    // 删除产品类型
    delSelectClick() {
      this.categoryId = 0
      this.queryProductId = ""
      this.getData()
    }
  },
  watch:{