Parcourir la source

Merge branch 'master' of http://git.dongkesoft.com:9001/iBOSS-2.0-Mini/iboss-mini-web

jiangn il y a 1 an
Parent
commit
990d5d47d3
1 fichiers modifiés avec 79 ajouts et 70 suppressions
  1. 79 70
      src/view/mst/goods-attr/index.vue

+ 79 - 70
src/view/mst/goods-attr/index.vue

@@ -165,6 +165,7 @@ export default {
   data() {
     let self = this
     return {
+      leftRow:null,
       //左侧列表
       leftData: [],
       kindList: [],
@@ -219,79 +220,87 @@ export default {
      */
     currentChangeEvent({row}) {
       if (row != null) {
+        this.leftRow = row
         this.kindCode = row.kindCode
-        let params = {
-          cpId: this.$store.state.user.cpId,
-        }
-
-        // 商品品牌
-        if (this.kindCode == this.$config.kindCode.goodsBrand || this.kindCode == null) {
-          setTimeout(()=>{
-            this.brandTableFlag = true
-          },100)
-          this.treeFlag = false
-          this.seriesTableFlag = false
-          this.unitTableFlag = false
-          params.brandCode = row.code
-          params.brandName = row.name
-          this.excute(this.$service.goodsBrandService, this.$service.goodsBrandService.selectByCond, params).then(res => {
-            if (res.code === this.$config.SUCCESS_CODE) {
-              this.brandTableData = res.data.list
-            }
-          })
-        }
-        // 商品种类
-        if (this.kindCode == this.$config.kindCode.goodsCategory) {
-          params.catCode = row.code
-          params.catName = row.name
-          setTimeout(()=>{
-            this.treeFlag = true
-          },100)
-          this.brandTableFlag = false
-          this.seriesTableFlag = false
-          this.unitTableFlag = false
-          this.excute(this.$service.goodsCategoryService, this.$service.goodsCategoryService.selectByCond, params).then(res => {
-            if (res.code === this.$config.SUCCESS_CODE) {
-              this.categoryTableData = res.data.list
-              this.categoryList = res.data.list
-            }
-          })
-        }
-        // 商品系列
-        if (this.kindCode == this.$config.kindCode.goodsSeries) {
-          params.seriesCode = row.code
-          params.seriesName = row.name
-          this.treeFlag = false
-          this.brandTableFlag = false
-          this.unitTableFlag = false
-          setTimeout(()=>{
-            this.seriesTableFlag = true
-          },100)
-          this.excute(this.$service.goodsSeriesService, this.$service.goodsSeriesService.selectByCond, params).then(res => {
-            if (res.code === this.$config.SUCCESS_CODE) {
-              this.seriesTableData = res.data.list
-            }
-          })
-        }
-        // 计量单位
-        if (this.kindCode == this.$config.kindCode.goodsUnit) {
-          params.unitCode = row.code
-          params.unitName = row.name
-          setTimeout(()=>{
-            this.unitTableFlag = true
-          },100)
-          this.treeFlag = false
-          this.seriesTableFlag = false
-          this.brandTableFlag = false
-          this.excute(this.$service.unitService, this.$service.unitService.selectByCond, params).then(res => {
-            if (res.code === this.$config.SUCCESS_CODE) {
-              this.unitTableData = res.data.list
-            }
-          })
-        }
+        this.searchData();
+      }
+    },
+    /**
+     * @desc   : 查询
+     * @author : 周兴
+     * @date   : 2024/7/29 13:18
+     */
+    getData(params){
+      // 商品品牌
+      if (this.kindCode == this.$config.kindCode.goodsBrand || this.kindCode == null) {
+        setTimeout(()=>{
+          this.brandTableFlag = true
+        },100)
+        this.treeFlag = false
+        this.seriesTableFlag = false
+        this.unitTableFlag = false
+        params.brandCode = this.leftRow.code
+        params.brandName = this.leftRow.name
+        this.excute(this.$service.goodsBrandService, this.$service.goodsBrandService.selectByCond, params).then(res => {
+          if (res.code === this.$config.SUCCESS_CODE) {
+            this.brandTableData = res.data.list
+          }
+          this.loading = false;
+        })
+      }
+      // 商品种类
+      else if (this.kindCode == this.$config.kindCode.goodsCategory) {
+        params.catCode = this.leftRow.code
+        params.catName = this.leftRow.name
+        setTimeout(()=>{
+          this.treeFlag = true
+        },100)
+        this.brandTableFlag = false
+        this.seriesTableFlag = false
+        this.unitTableFlag = false
+        this.excute(this.$service.goodsCategoryService, this.$service.goodsCategoryService.selectByCond, params).then(res => {
+          if (res.code === this.$config.SUCCESS_CODE) {
+            this.categoryTableData = res.data.list
+            this.categoryList = res.data.list
+          }
+          this.loading = false;
+        })
+      }
+      // 商品系列
+      else if (this.kindCode == this.$config.kindCode.goodsSeries) {
+        params.seriesCode = this.leftRow.code
+        params.seriesName = this.leftRow.name
+        this.treeFlag = false
+        this.brandTableFlag = false
+        this.unitTableFlag = false
+        setTimeout(()=>{
+          this.seriesTableFlag = true
+        },100)
+        this.excute(this.$service.goodsSeriesService, this.$service.goodsSeriesService.selectByCond, params).then(res => {
+          if (res.code === this.$config.SUCCESS_CODE) {
+            this.seriesTableData = res.data.list
+          }
+          this.loading = false;
+        })
+      }
+      // 计量单位
+      else if (this.kindCode == this.$config.kindCode.goodsUnit) {
+        params.unitCode = this.leftRow.code
+        params.unitName = this.leftRow.name
+        setTimeout(()=>{
+          this.unitTableFlag = true
+        },100)
+        this.treeFlag = false
+        this.seriesTableFlag = false
+        this.brandTableFlag = false
+        this.excute(this.$service.unitService, this.$service.unitService.selectByCond, params).then(res => {
+          if (res.code === this.$config.SUCCESS_CODE) {
+            this.unitTableData = res.data.list
+          }
+          this.loading = false;
+        })
       }
     },
-
     /**
      * @desc   : 新建按钮点击事件
      * @author : 常皓宁