yijing 1 год назад
Родитель
Сommit
1451aeb557

+ 122 - 52
src/views/warehouseManagement/stockManagement/add.vue

@@ -828,17 +828,43 @@ export default {
         let endIndex = row.packingSpecificationOption.findIndex(
           (ite) => row.packingUnit == ite.conversionUnit
         );
-        // packingQuantity 包装数量
+
+        console.log(row, 'rowwwwwwwwwwwwww')
+
+        // if (row.packingUnit == row.measureUnit) {
+        //   let total = 0;
+        //   console.log(row.packingUnit,'row.packingUnit')
+        //   if (row.packingUnit == '立方' && row.netWeight) {
+        //     total = Number(row.packingQuantity) * row.netWeight;
+        //     console.log(total, 'jjjjjjjj')
+        //   } else {
+        //     console.log('不一样的单位')
+        //     total = 0;
+        //   }
+        // } else {
+        //   let total = Number(row.packingQuantity);
+        //   // packingQuantity 包装数量
+        //   for (; startIndex < endIndex; endIndex--) {
+        //     total = this.$math.format(
+        //       row.packingSpecificationOption[endIndex].packageCell * total,
+        //       14
+        //     );
+        //   }
+        // }
         let total = Number(row.packingQuantity);
-        console.log(total, '22222222total');
 
-        for (; startIndex < endIndex; endIndex--) {
-          total = this.$math.format(
-            row.packingSpecificationOption[endIndex].packageCell * total,
-            14
-          );
+        if (row.packingUnit == row.measureUnit && row.measureUnit == '立方' && row.netWeight) {
+          total = Number(row.packingQuantity) * row.netWeight;
+          console.log(total, '单位是立方,计量单位也是立方,如果有单重,就计量数量x单重=总重')
+        } else {
+          for (; startIndex < endIndex; endIndex--) {
+            total = this.$math.format(
+              row.packingSpecificationOption[endIndex].packageCell * total,
+              14
+            );
+          }
         }
-        console.log(total, 'total');
+
         // 除了计量单位是KG以外计算总重  总重量 = 单重singleWeight * 数量measureQuantity(计量数量);
         // if (row.measuringUnit != 'KG') {
         //   row.weight = Number(row.singleWeight) * Number(row.measureQuantity);
@@ -2117,17 +2143,23 @@ export default {
         console.log('packingBoolen---------', packingBoolen);
         console.log('measureBoolen---------', measureBoolen);
         let packingNum = 0;
+
         // 处理单位为KG类的情况
         if (packingBoolen) {
-          let filterArr = row.packingSpecificationOption.filter((item) => {
-            return (
-              item.packageUnit == row.packingUnit &&
-              item.packageUnit != item.conversionUnit
+
+          if (!row.isUnpack && row.packingUnit == '立方') {
+            packingNum = 1;
+          } else {
+            let filterArr = row.packingSpecificationOption.filter((item) => {
+              return (
+                item.packageUnit == row.packingUnit &&
+                item.packageUnit != item.conversionUnit
+              );
+            });
+            packingNum = Math.ceil(
+              row.packingQuantity / filterArr[0].packageCell
             );
-          });
-          packingNum = Math.ceil(
-            row.packingQuantity / filterArr[0].packageCell
-          );
+          }
         }
         // 处理单位不为KG类,计量单位为KG类的情况
         let measureNum = row.packingQuantity;
@@ -2150,8 +2182,8 @@ export default {
           num = Math.ceil(
             row.measureQuantity / row.packingSpecificationOption[1]?.packageCell
           );
-          console.log(num, 'numnumnumnumnumnumnumnumnumnumnumnumnumnumnumnumnumnum33')
         }
+        console.log(packingNum, measureNum, num)
 
         if (row.packingSpecificationLabel?.length < 1) {
           return this.$message.error('请到主数据维护包装组信息!')
@@ -2214,13 +2246,19 @@ export default {
       let filterArr = [];
       // 处理单位为KG类的情况
       if (packingBoolen) {
-        filterArr = row.packingSpecificationOption.filter((item) => {
-          return (
-            item.packageUnit == row.packingUnit &&
-            item.packageUnit != item.conversionUnit
-          );
-        });
-        num = Math.ceil(row.packingQuantity / filterArr[0]?.packageCell);
+        console.log(packingBoolen, 'packingBoolenpackingBoolenpackingBoolenpackingBoolenpackingBoolenpackingBoolen')
+        if (!row.isUnpack && row.packingUnit == '立方') {
+          num = 1;
+        } else {
+          filterArr = row.packingSpecificationOption.filter((item) => {
+            return (
+              item.packageUnit == row.packingUnit &&
+              item.packageUnit != item.conversionUnit
+            );
+          });
+          num = Math.ceil(row.packingQuantity / filterArr[0]?.packageCell);
+        }
+
       } else {
         if (row.isUnpack == 1) {
           if (measureBoolen) {
@@ -2260,16 +2298,29 @@ export default {
       console.log('num-----------', num);
       for (let index = 0; index < num; index++) {
         let measureQuantity = 1;
+        let packingQuantity = 1;
+        let packingUnit = row.packingUnit;
+        console.log(packingUnit, 'packingUnit 立方ma ')
         // 处理单位为KG类,计算每桶KG值
         if (packingBoolen) {
-          measureQuantity =
-            Number(row.packingQuantity) >
-              this.$math.format(filterArr[0].packageCell * (index + 1), 14)
-              ? filterArr[0].packageCell
-              : Number(row.packingQuantity) -
-              this.$math.format(filterArr[0].packageCell * index, 14);
+          if (!row.isUnpack && row.packingUnit == '立方') {
+            let result = row.packingQuantity / row.packingSpecificationOption[1].packageCell;
+            packingQuantity = Math.ceil(result * 100) / 100;
+            console.log(packingQuantity, '包装数oppppp量')
+            measureQuantity = row.measureQuantity
+            console.log(measureQuantity, '计量数oppppp量')
+            packingUnit = row.packingUnit;
+          } else {
+            measureQuantity =
+              Number(row.packingQuantity) >
+                this.$math.format(filterArr[0].packageCell * (index + 1), 14)
+                ? filterArr[0].packageCell
+                : Number(row.packingQuantity) -
+                this.$math.format(filterArr[0].packageCell * index, 14);
+          }
         } else {
           if (row.isUnpack == 1) {
+            console.log('1 不拆--------', measureBoolen)
             if (measureBoolen) {
               // 处理单位不为KG类,计量单位为KG类的情况
               let splitIndex = row.packingSpecificationOption.findIndex(
@@ -2285,6 +2336,7 @@ export default {
                 );
               }
             } else {
+              console.log('2 不拆--------')
               let splitIndex = row.packingSpecificationOption.findIndex(
                 (item) =>
                   item.conversionUnit == row.packingUnit &&
@@ -2299,12 +2351,14 @@ export default {
               }
             }
           } else {
+            console.log('3 不拆--------')
             if (row.packingQuantity) {
               measureQuantity = row.measureQuantity / row.packingQuantity;
             }
             console.log(measureQuantity, 'measureQuantity')
           }
         }
+        console.log(filterArr[0], 'filterArr[0]')
         let item = {
           index: row.index + '-' + index, // 包装索引
           warehouseId: row.warehouseId, // 仓库id
@@ -2318,7 +2372,8 @@ export default {
           parentIndex: row.index, // 产品索引
           batchNo: row.batchNo, // 批次号
           packageNo: packingCodeList[index]?.onlyCode, // 包装编码
-          packingQuantity: 1, // 包装数量
+          packingQuantity: packingQuantity, // 包装数量
+
           packingUnit: row.isUnpack
             ? packingBoolen
               ? filterArr[0].conversionUnit
@@ -2328,7 +2383,7 @@ export default {
                   : row.packingSpecificationOption[0].conversionUnit
                 : row.measureUnit
             : packingBoolen
-              ? filterArr[0].conversionUnit
+              ? row.packingUnit === '立方' ? row.packingUnit : filterArr[0]?.conversionUnit
               : row.packingUnit,
 
           measureQuantity: row.isUnpack
@@ -2481,40 +2536,54 @@ export default {
         .dictValue;
       let measureBoolen = !!this.getDict('不拆物料层规格', row.measureUnit)
         .dictValue;
+      console.log(packingBoolen, 'packingBoolen')
+      console.log(measureBoolen, 'measureBoolen')
+
       if (idx > -1) {
         if (row.packingQuantity > 0) {
           console.log(packingBoolen, '111')
+
           if (packingBoolen) {
-            let filterArr = row.packingSpecificationOption.filter((item) => {
-              return (
-                item.packageUnit == row.packingUnit &&
-                item.packageUnit != item.conversionUnit
+            console.log(packingBoolen, 'packingBoolen', row.packageUnit, row.isUnpack);
+            if (!row.isUnpack && row.packingUnit == '立方') {
+              let num = 1
+              this.$refs.wareHouseDailogRef.open(
+                num,
+                idx,
+                row.warehouseId,
+                row.warehouseName + '',
+                row.categoryLevelPathIdParent
               );
-            });
-            console.log(filterArr, 'ffff');
-            console.log(row, 'rrrrr');
-            let num = Math.ceil(
-              row.packingQuantity / filterArr[0].packageCell
-            );
-            this.$refs.wareHouseDailogRef.open(
-              num,
-              idx,
-              row.warehouseId,
-              row.warehouseName + '',
-              row.categoryLevelPathIdParent
-            );
+            } else {
+              let filterArr = row.packingSpecificationOption.filter((item) => {
+                return (
+                  item.packageUnit == row.packingUnit &&
+                  item.packageUnit != item.conversionUnit
+                );
+              });
+
+              let num = Math.ceil(
+                row.packingQuantity / filterArr[0].packageCell
+              );
+              this.$refs.wareHouseDailogRef.open(
+                num,
+                idx,
+                row.warehouseId,
+                row.warehouseName + '',
+                row.categoryLevelPathIdParent
+              );
+            }
+
           } else {
-            console.log(measureBoolen, '222')
+            console.log(measureBoolen, 'measureBoolen');
             let num = row.packingQuantity;
             if (measureBoolen) {
-
               let splitIndex = row.packingSpecificationOption.findIndex(
                 (item) =>
                   item.conversionUnit == row.packingUnit &&
                   item.packageUnit != item.conversionUnit
               );
               for (; splitIndex > 1; splitIndex--) {
-                console.log(splitIndex);
                 num = this.$math.format(
                   num *
                   row.packingSpecificationOption[splitIndex].packageCell,
@@ -2529,6 +2598,7 @@ export default {
                 row.categoryLevelPathIdParent
               );
             } else {
+              console.log(packingBoolen, measureBoolen, '33333');
 
               let num = Math.ceil(
                 row.measureQuantity / row.packingSpecificationOption[1]?.packageCell

+ 258 - 349
src/views/warehouseManagement/stockManagement/components/selectType.vue

@@ -1,158 +1,61 @@
 <template>
   <div>
-    <el-dialog
-      :title="`${title}信息`"
-      append-to-body
-      :close-on-click-modal="false"
-      :visible="visibleDialog"
-      :before-close="closeWindows"
-      width="80vw"
-    >
+    <el-dialog :title="`${title}信息`" append-to-body :close-on-click-modal="false" :visible="visibleDialog"
+      :before-close="closeWindows" width="80vw">
       <div class="search_box">
         <el-row :gutter="15">
           <el-col :span="6">
             <el-form label-width="80px" class="ele-form-search">
               <el-form-item label="所属工厂" prop="factoryId">
-                <el-select
-                  filterable
-                  placeholder="请选择"
-                  v-model="factoryId"
-                  clearable
-                  class="w100"
-                >
-                  <el-option
-                    v-for="item in factoryList"
-                    :key="item.id"
-                    :label="item.name"
-                    :value="item.id"
-                  ></el-option>
+                <el-select filterable placeholder="请选择" v-model="factoryId" clearable class="w100">
+                  <el-option v-for="item in factoryList" :key="item.id" :label="item.name" :value="item.id"></el-option>
                 </el-select>
               </el-form-item>
             </el-form>
           </el-col>
           <el-col :span="8">
             <el-input v-model="value" placeholder="搜索物品编码、名称、规格等">
-              <el-button
-                slot="append"
-                type="primary"
-                icon="el-icon-search"
-                size="small"
-                @click="handleSearch"
-                >搜索</el-button
-              >
+              <el-button slot="append" type="primary" icon="el-icon-search" size="small"
+                @click="handleSearch">搜索</el-button>
             </el-input>
           </el-col>
         </el-row>
       </div>
       <div class="flex_info">
         <div class="flex_left">
-          <AssetTree
-            ref="treeList"
-            :treeIds="treeIds"
-            @handleNodeClick="handleNodeClick"
-          />
+          <AssetTree ref="treeList" :treeIds="treeIds" @handleNodeClick="handleNodeClick" />
         </div>
         <div class="flex_right">
-          <el-table
-            ref="multipleTable"
-            :data="tableData"
-            border
-            tooltip-effect="dark"
-            height="455px"
-            style="width: 100%"
-            :header-cell-style="{ background: '#F0F3F3', border: 'none' }"
-            @selection-change="handleSelectionChange"
-          >
-            <el-table-column
-              type="selection"
-              width="55"
-              align="center"
-              fixed="left"
-            >
+          <el-table ref="multipleTable" :data="tableData" border tooltip-effect="dark" height="455px"
+            style="width: 100%" :header-cell-style="{ background: '#F0F3F3', border: 'none' }"
+            @selection-change="handleSelectionChange">
+            <el-table-column type="selection" width="55" align="center" fixed="left">
             </el-table-column>
-            <el-table-column
-              width="55px"
-              label="序号"
-              type="index"
-              fixed="left"
-            >
+            <el-table-column width="55px" label="序号" type="index" fixed="left">
+            </el-table-column>
+            <el-table-column prop="assetCode" label="物品编码" fixed="left" :show-overflow-tooltip="true"></el-table-column>
+            <el-table-column prop="assetName" label="物品名称" fixed="left" :show-overflow-tooltip="true"></el-table-column>
+            <el-table-column prop="brandNum" label="牌号" :show-overflow-tooltip="true"></el-table-column>
+            <el-table-column prop="modelType" label="型号" :show-overflow-tooltip="true"></el-table-column>
+            <el-table-column prop="specification" label="规格" :show-overflow-tooltip="true"></el-table-column>
+            <el-table-column v-for="(item, index) in newColumns" :label="item.label" :align="item.align"
+              :prop="item.prop" :show-overflow-tooltip="item.showOverflowTooltip"></el-table-column>
+            <el-table-column prop="measuringUnit" label="计量单位" :show-overflow-tooltip="true"></el-table-column>
+            <el-table-column prop="weightUnit" label="重量单位" :show-overflow-tooltip="true"></el-table-column>
+            <el-table-column prop="roughWeight" label="毛重" :show-overflow-tooltip="true"></el-table-column>
+            <el-table-column prop="netWeight" label="净重" :show-overflow-tooltip="true"></el-table-column>
+            <el-table-column prop="packingUnit" label="包装单位" :show-overflow-tooltip="true"></el-table-column>
+            <el-table-column prop="categoryLevelPath" label="分类" :show-overflow-tooltip="true"></el-table-column>
+            <el-table-column label="允许拆包" prop="isUnpack">
+              <template slot-scope="{ row, $index }">
+                {{ row.isUnpack ? '是' : '否' }}
+              </template>
             </el-table-column>
-            <el-table-column
-              prop="assetCode"
-              label="物品编码"
-              fixed="left"
-              :show-overflow-tooltip="true"
-            ></el-table-column>
-            <el-table-column
-              prop="assetName"
-              label="物品名称"
-              fixed="left"
-              :show-overflow-tooltip="true"
-            ></el-table-column>
-            <el-table-column
-              prop="brandNum"
-              label="牌号"
-              :show-overflow-tooltip="true"
-            ></el-table-column>
-            <el-table-column
-              prop="modelType"
-              label="型号"
-              :show-overflow-tooltip="true"
-            ></el-table-column>
-            <el-table-column
-              prop="specification"
-              label="规格"
-              :show-overflow-tooltip="true"
-            ></el-table-column>
-            <el-table-column
-              v-for="(item, index) in newColumns"
-              :label="item.label"
-              :align="item.align"
-              :prop="item.prop"
-              :show-overflow-tooltip="item.showOverflowTooltip"
-            ></el-table-column>
-            <el-table-column
-              prop="measuringUnit"
-              label="计量单位"
-              :show-overflow-tooltip="true"
-            ></el-table-column>
-            <el-table-column
-              prop="weightUnit"
-              label="重量单位"
-              :show-overflow-tooltip="true"
-            ></el-table-column>
-            <el-table-column
-              prop="roughWeight"
-              label="毛重"
-              :show-overflow-tooltip="true"
-            ></el-table-column>
-            <el-table-column
-              prop="netWeight"
-              label="净重"
-              :show-overflow-tooltip="true"
-            ></el-table-column>
-            <el-table-column
-              prop="packingUnit"
-              label="包装单位"
-              :show-overflow-tooltip="true"
-            ></el-table-column>
-            <el-table-column
-              prop="categoryLevelPath"
-              label="分类"
-              :show-overflow-tooltip="true"
-            ></el-table-column>
           </el-table>
           <div class="right mt10">
-            <el-pagination
-              background
-              layout="total, sizes, prev, pager, next, jumper"
-              :total="total"
-              :page-sizes="[20, 30, 50, 100, 500]"
-              :page-size.sync="pages.size"
-              :current-page.sync="pages.pageNum"
-              @current-change="handleCurrentChange"
-              @size-change="handleSizeChange"
-            >
+            <el-pagination background layout="total, sizes, prev, pager, next, jumper" :total="total"
+              :page-sizes="[20, 30, 50, 100, 500]" :page-size.sync="pages.size" :current-page.sync="pages.pageNum"
+              @current-change="handleCurrentChange" @size-change="handleSizeChange">
             </el-pagination>
           </div>
         </div>
@@ -166,244 +69,250 @@
 </template>
 
 <script>
-  import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
-  import AssetTree from './assetTree.vue';
-  import { getList } from '@/api/classifyManage/itemInformation';
-  import storageApi from '@/api/warehouseManagement/index.js';
-  export default {
-    props: {
-      visibleDialog: {
-        type: Boolean,
-        default: false
-      },
-      title: {
-        type: String,
-        default: ''
-      },
-      bizScene: {
-        type: String,
-        default: ''
-      },
-      treeIds: {
-        type: Array,
-        default: () => []
-      },
-      loadTree: {
-        type: Boolean,
-        default: true
-      }
+import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
+import AssetTree from './assetTree.vue';
+import { getList } from '@/api/classifyManage/itemInformation';
+import storageApi from '@/api/warehouseManagement/index.js';
+export default {
+  props: {
+    visibleDialog: {
+      type: Boolean,
+      default: false
     },
-    watch: {
-      tableData(val) {
-        this.doLayout();
-      },
-      visibleDialog: {
-        handler(v) {
-          if (v) {
-            this.getTreeList();
-          }
-        },
-        deep: true
-      }
+    title: {
+      type: String,
+      default: ''
     },
-    components: { AssetTree },
-    data() {
-      return {
-        factoryList: [],
-        factoryId: '',
-        value: '',
-        treeType: '',
-        treeList: [],
-        tableData: [],
-        multipleSelection: [],
-        pages1: { classificationIdList: [] },
-        pages: {
-          pageNum: 1,
-          size: 20
-        },
-        total: 0,
-        curType: '',
-        classificationId: '',
-        memoSelection: [],
-        newColumns: [] // 动态表头
-      };
+    bizScene: {
+      type: String,
+      default: ''
     },
-    created() {
-      this.getFieldModel();
-      this.getFactoryList();
+    treeIds: {
+      type: Array,
+      default: () => []
     },
-    methods: {
-      //获取工厂列表
-      async getFactoryList() {
-        const res = await warehouseDefinition.getFactoryarea({
-          pageNum: 1,
-          size: 9999,
-          type: 1
-        });
-        this.factoryList = res.list;
+    loadTree: {
+      type: Boolean,
+      default: true
+    }
+  },
+  watch: {
+    tableData(val) {
+      this.doLayout();
+    },
+    visibleDialog: {
+      handler(v) {
+        if (v) {
+          this.getTreeList();
+        }
       },
-      doLayout() {
-        let that = this;
-        this.$nextTick(() => {
-          that.$refs.multipleTable.doLayout();
-        });
+      deep: true
+    }
+  },
+  components: { AssetTree },
+  data() {
+    return {
+      factoryList: [],
+      factoryId: '',
+      value: '',
+      treeType: '',
+      treeList: [],
+      tableData: [],
+      multipleSelection: [],
+      pages1: { classificationIdList: [] },
+      pages: {
+        pageNum: 1,
+        size: 20
       },
-      // 获取动态表头
-      getFieldModel() {
-        storageApi.fieldModel({ fieldModel: 't_main_category' }).then((res) => {
-          let newRes = res.map((m) => {
-            return {
-              prop: 'extField.' + m.prop,
-              label: m.label,
-              align: 'center',
-              showOverflowTooltip: true
-            };
-          });
-          this.newColumns = [...newRes];
+      total: 0,
+      curType: '',
+      classificationId: '',
+      memoSelection: [],
+      newColumns: [] // 动态表头
+    };
+  },
+  created() {
+    this.getFieldModel();
+    this.getFactoryList();
+  },
+  methods: {
+    //获取工厂列表
+    async getFactoryList() {
+      const res = await warehouseDefinition.getFactoryarea({
+        pageNum: 1,
+        size: 9999,
+        type: 1
+      });
+      this.factoryList = res.list;
+    },
+    doLayout() {
+      let that = this;
+      this.$nextTick(() => {
+        that.$refs.multipleTable.doLayout();
+      });
+    },
+    // 获取动态表头
+    getFieldModel() {
+      storageApi.fieldModel({ fieldModel: 't_main_category' }).then((res) => {
+        let newRes = res.map((m) => {
+          return {
+            prop: 'extField.' + m.prop,
+            label: m.label,
+            align: 'center',
+            showOverflowTooltip: true
+          };
         });
-      },
-      handleSearch() {
-        this.pages.pageNum = 1;
-        this.initData();
-      },
-      onConfirm() {
-        console.log([...this.memoSelection, ...this.multipleSelection]);
-        this.$emit('selectTableData', [
-          ...this.memoSelection,
-          ...this.multipleSelection
-        ]);
-        this.closeWindows();
-      },
-      getTreeList() {
-        this.$nextTick(() => {
-          this.$refs.treeList.getTreeData().then((data) => {
-            this.handleNodeClick(data);
-          });
+        this.newColumns = [...newRes];
+      });
+    },
+    handleSearch() {
+      this.pages.pageNum = 1;
+      this.initData();
+    },
+    onConfirm() {
+      console.log([...this.memoSelection, ...this.multipleSelection]);
+      this.$emit('selectTableData', [
+        ...this.memoSelection,
+        ...this.multipleSelection
+      ]);
+      this.closeWindows();
+    },
+    getTreeList() {
+      this.$nextTick(() => {
+        this.$refs.treeList.getTreeData().then((data) => {
+          this.handleNodeClick(data);
         });
-      },
-      setclassIds(data, list) {
-        if (data && data.length !== 0) {
-          data.forEach((item) => {
-            if (item.children && item.children.length !== 0) {
-              this.setclassIds(item.children, list);
-            }
-            list.push(item.id);
-          });
-        }
-        return list;
-      },
-      handleSelectionChange(val) {
-        this.multipleSelection = val;
-      },
-      handleNodeClick(data) {
-        console.log('-----------------');
-        console.log(data);
-        this.classificationId = data.id;
-        this.curType = data.type;
-        this.initData();
-      },
-      closeWindows() {
-        this.memoSelection = [];
-        this.multipleSelection = [];
-        this.$emit('update:loadTree', false);
-        this.$emit('update:visibleDialog', false);
-        this.pages.pageNum = 1;
-      },
-      handleCurrentChange(e) {
-        this.initData();
-      },
-      handleSizeChange(e) {
-        this.pages.pageNum = 1;
-        this.initData();
-      },
-      initData() {
-        this.memoSelection = this.multipleSelection.reduce((cur, pre) => {
-          if (!this.memoSelection.some((i) => i.curId === pre.curId)) {
-            cur.push(pre);
+      });
+    },
+    setclassIds(data, list) {
+      if (data && data.length !== 0) {
+        data.forEach((item) => {
+          if (item.children && item.children.length !== 0) {
+            this.setclassIds(item.children, list);
           }
-          return cur;
-        }, this.memoSelection.slice(0));
-        this._getInformation();
-      },
-      async _getInformation() {
-        const params = {
-          ...this.pages,
-          // type: this.curType,
-          // code: this.value,
-          factoryId: this.factoryId,
-          searchKey: this.value,
-          categoryLevelId: this.classificationId
-        };
-        console.log(params);
-        const res = await getList(params);
+          list.push(item.id);
+        });
+      }
+      return list;
+    },
+    handleSelectionChange(val) {
+      this.multipleSelection = val;
+    },
+    handleNodeClick(data) {
+      console.log('-----------------');
+      console.log(data);
+      this.classificationId = data.id;
+      this.curType = data.type;
+      this.initData();
+    },
+    closeWindows() {
+      this.memoSelection = [];
+      this.multipleSelection = [];
+      this.$emit('update:loadTree', false);
+      this.$emit('update:visibleDialog', false);
+      this.pages.pageNum = 1;
+    },
+    handleCurrentChange(e) {
+      this.initData();
+    },
+    handleSizeChange(e) {
+      this.pages.pageNum = 1;
+      this.initData();
+    },
+    initData() {
+      this.memoSelection = this.multipleSelection.reduce((cur, pre) => {
+        if (!this.memoSelection.some((i) => i.curId === pre.curId)) {
+          cur.push(pre);
+        }
+        return cur;
+      }, this.memoSelection.slice(0));
+      this._getInformation();
+    },
+    async _getInformation() {
+      const params = {
+        ...this.pages,
+        // type: this.curType,
+        // code: this.value,
+        factoryId: this.factoryId,
+        searchKey: this.value,
+        categoryLevelId: this.classificationId
+      };
+      console.log(params);
+      const res = await getList(params);
 
-        if (res && this.classificationId == params.categoryLevelId) {
-          const curMap = {
-            assetId: 'id',
-            assetCode: 'code', //编码
-            assetName: 'name', //名称
-            materialId: 'id',
-            materialName: 'informationName',
-            batchNo: '', //批次号
-            unit: 'measuringUnit', //单位
-            minPackUnit: 'packingUnit' //最小包装单位
-          };
-          this.tableData = res.list.map((item) => {
-            for (const key in curMap) {
-              item[key] = curMap[key] ? item[curMap[key]] : '';
-            }
-            item.curId = item.id;
+      if (res && this.classificationId == params.categoryLevelId) {
+        const curMap = {
+          assetId: 'id',
+          assetCode: 'code', //编码
+          assetName: 'name', //名称
+          materialId: 'id',
+          materialName: 'informationName',
+          batchNo: '', //批次号
+          unit: 'measuringUnit', //单位
+          minPackUnit: 'packingUnit' //最小包装单位
+        };
+        this.tableData = res.list.map((item) => {
+          for (const key in curMap) {
+            item[key] = curMap[key] ? item[curMap[key]] : '';
+          }
+          item.curId = item.id;
 
-            return item;
-          });
+          return item;
+        });
 
-          this.$nextTick(() => {
-            this.tableData.forEach((item) => {
-              const index = this.memoSelection.findIndex(
-                (i) => item.curId === i.curId
-              );
-              if (index > -1) {
-                // 删除还给 multipleSelection
-                this.$refs.multipleTable.toggleRowSelection(item, true);
-                this.memoSelection.splice(index, 1);
-              }
-            });
+        this.$nextTick(() => {
+          this.tableData.forEach((item) => {
+            const index = this.memoSelection.findIndex(
+              (i) => item.curId === i.curId
+            );
+            if (index > -1) {
+              // 删除还给 multipleSelection
+              this.$refs.multipleTable.toggleRowSelection(item, true);
+              this.memoSelection.splice(index, 1);
+            }
           });
-          this.total = res.count;
-        }
+        });
+        this.total = res.count;
       }
     }
-  };
+  }
+};
 </script>
 
 <style lang="scss" scoped>
-  .flex_info {
-    display: flex;
-    margin-top: 20px;
-    margin-bottom: 20px;
-    .flex_left {
-      width: 202px;
-      height: 434px;
-      padding: 10px;
-      border: 1px solid #d7d7d7;
-      overflow-y: auto;
-    }
-    .flex_right {
-      flex: 1;
-      margin-left: 10px;
-      overflow: hidden;
-    }
+.flex_info {
+  display: flex;
+  margin-top: 20px;
+  margin-bottom: 20px;
+
+  .flex_left {
+    width: 202px;
+    height: 434px;
+    padding: 10px;
+    border: 1px solid #d7d7d7;
+    overflow-y: auto;
   }
-  .search_box {
+
+  .flex_right {
+    flex: 1;
+    margin-left: 10px;
     overflow: hidden;
   }
-  .select-btn {
-    text-align: right;
-  }
-  .right {
-    text-align: right;
-  }
-  .mt10 {
-    margin-top: 10px;
-  }
+}
+
+.search_box {
+  overflow: hidden;
+}
+
+.select-btn {
+  text-align: right;
+}
+
+.right {
+  text-align: right;
+}
+
+.mt10 {
+  margin-top: 10px;
+}
 </style>