From 5ecb7958c96d3f0b6d47b79aff7eb306c2cf690f Mon Sep 17 00:00:00 2001
From: charles <981744753@qq.com>
Date: 星期二, 06 八月 2024 11:16:58 +0800
Subject: [PATCH] gitlab上面的wms转移到公司git

---
 src/views/other/commonDialog/SelectCommonDialog.vue |  144 +++++++++++++++++++++++++++++++++++++----------
 1 files changed, 113 insertions(+), 31 deletions(-)

diff --git a/src/views/other/commonDialog/SelectCommonDialog.vue b/src/views/other/commonDialog/SelectCommonDialog.vue
index 9ea4514..558bb20 100644
--- a/src/views/other/commonDialog/SelectCommonDialog.vue
+++ b/src/views/other/commonDialog/SelectCommonDialog.vue
@@ -10,15 +10,28 @@
       <div slot="title" class="tac drawerHeader">{{ editCommonConfig.title }}</div>
 
       <div class="bg-view">
-        <div class="query-bg">
-          <el-input
-            v-model="bomParams.keyword"
-            placeholder="鎼滅储浜у搧鍚嶇О锛岀紪鐮佺瓑鍏抽敭璇�"
-            style="width: 60%; margin-right: 10px"
-          ></el-input>
-          <el-button type="primary" @click="searchClick">鏌ヨ</el-button>
+        <div style="display: flex;justify-content: space-between">
+          <div class="query-bg" style="margin: 10px">
+            <el-input
+                    v-model="bomParams.keyword"
+                    placeholder="鎼滅储浜у搧鍚嶇О锛岀紪鐮佺瓑鍏抽敭璇�"
+            ></el-input>
+            <el-button type="primary" @click="searchClick">鏌ヨ</el-button>
+          </div>
+          <div style="margin: 10px">
+            <el-cascader
+                    v-model="categoryIds"
+                    collapse-tags
+                    placeholder="璇烽�夋嫨浜у搧绫诲埆"
+                    :options="productCategoryList"
+                    :props="props"
+                    clearable
+                    @change="getProductList"
+            ></el-cascader>
+          </div>
         </div>
         <TableCommonView
+          :warehouseId="warehouseId"
           class="bg-list"
           ref="tableListRef"
           :loading="loading"
@@ -52,12 +65,18 @@
 </template>
 
 <script>
-import { getProductList } from "@/api/product/product"
+import { getProductList,locationProductListApi } from "@/api/product/product"
 import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
+import { getProductCategoryList } from '@/api/product/productCategory'
+import { getTreeData } from '@/common/untils/index';
 export default {
   name: "EditSelCommonDialog",
   mixins: [pageMixin],
   props: {
+      warehouseId:{
+        type:Number,
+        default:0
+      },
     editCommonConfig: {
       type: Object,
       default: () => {
@@ -82,6 +101,12 @@
   computed: {},
   data() {
     return {
+        categoryIds:[],
+        props:{
+            label:'name',
+            value:'id',
+            multiple:true
+        },
       dialogWidth: "42rem",
       pagerCount: 5,
       editConfig: this.editCommonConfig,
@@ -94,12 +119,14 @@
         page: 1,
         pageSize: 10,
         types: ["鍘熸潗鏂�", "鍗婃垚鍝�", "鎴愬搧"]
-      }
+      },
+      productCategoryList:[]
     }
   },
   created() {
-    this.setTable()
-    this.getData()
+    this.setTable();
+    this.getData();
+    this.queryProductCategoryList();
   },
   methods: {
     setTable() {
@@ -121,7 +148,15 @@
       this.tableList.allcol = allcol
     },
     setTopTableColumn(showcol) {
+
       let tableColumn = [
+          {
+              label: "浜у搧缂栫爜",
+              prop: "id",
+              min: 110,
+              isShowColumn: true,
+              default: true
+          },
         {
           label: "浜у搧鍚嶇О",
           prop: "name",
@@ -129,13 +164,26 @@
           default: true,
           isClick: true
         },
-        {
-          label: "浜у搧缂栫爜",
-          prop: "id",
-          min: 110,
-          isShowColumn: true,
-          default: true
-        },
+          /*{
+              label: "浜у搧绫诲埆",
+              prop: "categoryName",
+              isShowColumn: true,
+              default: true
+          },*/
+          {
+              label: "浣嶇疆",
+              prop: "locationName",
+              min: 110,
+              isShowColumn: true,
+              default: true
+          },
+          {
+              label: "鏁伴噺",
+              prop: "amount",
+              min: 110,
+              isShowColumn: true,
+              default: true
+          },
         {
           label: "浜у搧瑙勬牸",
           prop: "specs",
@@ -160,6 +208,12 @@
     getSelectArray(val) {
       this.selectArray = val
     },
+      async queryProductCategoryList(){
+        const {code ,data}=await getProductCategoryList({page:0,pageSize:0});
+        if(code===200){
+            this.productCategoryList=getTreeData(data);
+        }
+      }  ,
     saveClick() {
       this.$emit("getSelectArray", this.selectArray)
       this.editConfig.editVisible = false
@@ -175,19 +229,47 @@
     async getProductList() {
       this.bomParams.page = this.pagerOptions.currPage ? this.pagerOptions.currPage : 1
       this.bomParams.pageSize = this.pagerOptions.pageSize ? this.pagerOptions.pageSize : 15
-      let params = JSON.parse(JSON.stringify(this.bomParams))
-      await getProductList(params).then((res) => {
-        console.log(res.data)
-        if (res.code === 200) {
-          if (res.data) {
-            this.tableList.tableInfomation = res.data || []
-            this.pagerOptions.totalCount = res.total ? res.total : 0
-          } else {
-            this.tableList.tableInfomation = []
-          }
-        }
-        this.loading = false
-      })
+      let params = JSON.parse(JSON.stringify(this.bomParams));
+      const routerParams=this.$route.query;
+      const ids=[...new Set(this.categoryIds.flat(Infinity))];
+       params.categoryIds=ids;
+        if(routerParams.workType==1){
+          await getProductList(params).then((res) => {
+              console.log(res.data)
+              if (res.code === 200) {
+                  if (res.data) {
+                      this.tableList.tableInfomation = res.data || []
+                      this.pagerOptions.totalCount = res.total ? res.total : 0
+                  } else {
+                      this.tableList.tableInfomation = []
+                  }
+              }
+              this.loading = false
+          })
+      }else{
+          params={
+              "keyword": "",
+              "page":this.pagerOptions.currPage ? this.pagerOptions.currPage : 1,
+              "pageSize": this.pagerOptions.pageSize ? this.pagerOptions.pageSize : 15,
+              "warehouseId": routerParams.warehouseId?parseInt(routerParams.warehouseId):this.warehouseId
+          };
+          params.categoryIds=ids;
+          locationProductListApi(params).then(res=>{
+              if (res.code === 200) {
+                  if (res.data) {
+                      this.tableList.tableInfomation = res.data || []
+                      this.tableList.tableInfomation.map(item=>{
+                          item.locationName=item.location.name;
+                      });
+                      this.pagerOptions.totalCount = res.total ? res.total : 0
+                  } else {
+                      this.tableList.tableInfomation = []
+                  }
+              }
+              this.loading = false
+          });
+      }
+
     },
     handleClose() {
       this.editConfig.editVisible = false

--
Gitblit v1.8.0