huang_an пре 1 година
родитељ
комит
e27de7b6fb
20 измењених фајлова са 4965 додато и 880 уклоњено
  1. 11 0
      src/api/classifyManage/index.js
  2. 22 0
      src/api/ruleManagement/plan.js
  3. 230 0
      src/components/selectTree/index_other.vue
  4. 27 36
      src/views/classifyManage/treeClassify/components/list-edit.vue
  5. 512 0
      src/views/rulesManagement/Inventory/components/AssetsInWarehouse.vue
  6. 204 14
      src/views/rulesManagement/Inventory/components/addInventoryDialog.vue
  7. 0 0
      src/views/rulesManagement/Inventory/components/inventory-search.vue
  8. 90 0
      src/views/rulesManagement/Inventory/components/tableContentData.js
  9. 227 0
      src/views/rulesManagement/Inventory/index.vue
  10. 0 520
      src/views/rulesManagement/planRules/components/AssetsInWarehouse.vue
  11. 0 86
      src/views/rulesManagement/planRules/components/tableContentData.js
  12. 10 224
      src/views/rulesManagement/planRules/index.vue
  13. 512 0
      src/views/rulesManagement/warehouseInventory/components/AssetsInWarehouse.vue
  14. 1067 0
      src/views/rulesManagement/warehouseInventory/components/addInventoryDialog copy.vue
  15. 1054 0
      src/views/rulesManagement/warehouseInventory/components/addInventoryDialog.vue
  16. 124 0
      src/views/rulesManagement/warehouseInventory/components/assetTree.vue
  17. 200 0
      src/views/rulesManagement/warehouseInventory/components/inventory-search.vue
  18. 358 0
      src/views/rulesManagement/warehouseInventory/components/selectType.vue
  19. 90 0
      src/views/rulesManagement/warehouseInventory/components/tableContentData.js
  20. 227 0
      src/views/rulesManagement/warehouseInventory/index.vue

+ 11 - 0
src/api/classifyManage/index.js

@@ -69,3 +69,14 @@ export async function getInfoById(id) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+// 根据ids查询物品分类
+export async function getTreeByIds(data) {
+  const res = await request.get(`/pda/main/categoryLevel/pdaTreeByPid`, {
+    params: data
+  });
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 22 - 0
src/api/ruleManagement/plan.js

@@ -122,6 +122,28 @@ export async function deleteStocktakingPlan(data) {
   return Promise.reject(new Error(res.data.message));
 }
 
+// 物品维度台账列表
+export async function getProductList(params) {
+  const res = await request.get(`/wms/outindetailtwo/page`, {
+    params
+  });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 批次维度台账列表
+export async function getBatchList(params) {
+  const res = await request.get(`/wms/outindetailtwo/batchPage`, {
+    params
+  });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
 // // 更新或保存
 // export async function saveOrUpdate (data) {
 //   const res = await request.post('/main/ruleinfo/saveOrEdit', data);

+ 230 - 0
src/components/selectTree/index_other.vue

@@ -0,0 +1,230 @@
+<template>
+  <el-select
+    filterable
+    ref="test"
+    :size="size"
+    :disabled="isBindPlan"
+    :value="valueTitle"
+    :clearable="clearable"
+    @clear="clearHandle"
+    :placeholder="placeholder"
+  >
+    <el-option :value="valueTitle" :label="valueTitle" class="options">
+      <slot :pHandleNodeClick="handleNodeClick">
+        <el-tree
+          id="tree-option"
+          ref="selectTree"
+          :key="treeKey"
+          :accordion="accordion"
+          :data="options"
+          :props="props"
+          :expand-on-click-node="false"
+          :node-key="props.value"
+          :default-expand-all="isAll"
+          :default-expanded-keys="defaultExpandedKey"
+          @node-click="handleNodeClick"
+        >
+        </el-tree>
+      </slot>
+    </el-option>
+  </el-select>
+</template>
+
+<script>
+  export default {
+    props: {
+      // 配置项
+      props: {
+        type: Object,
+        default() {
+          return {
+            value: 'value', // ID字段名
+            label: 'label', // 显示名称
+            children: 'children' // 子级字段名
+          };
+        }
+      },
+      // 展开可不展开
+      isAll: { type: Boolean, default: true },
+      // 选项列表数据(树形结构的对象数组)
+      options: { type: Array, default: () => [] },
+      // 初始值
+      value: { type: [String, Number], default: null },
+      // 可清空选项
+      clearable: { type: Boolean, default: false },
+      // 自动收起
+      accordion: { type: Boolean, default: false },
+      // // 可清空选项
+      // disabled: { type: Boolean, default: false },
+      // 多选
+      multiple: { type: Boolean, default: false },
+      //
+
+      placeholder: {
+        type: String,
+        default: '请选择'
+      },
+      size: {
+        type: String,
+        default: 'mini'
+      },
+      dialogType: {
+        type: String,
+        default: ''
+      },
+      tableIndex: { type: Number, default: null },
+      initStr: {
+        type: String,
+        default: ''
+      },
+      isBindPlan: {
+        type: Boolean,
+        default: function () {
+          return false;
+        }
+      }
+    },
+    data() {
+      return {
+        valueIds: '',
+        valueId: null,
+        treeKey: true,
+        valueTitle: '',
+        defaultExpandedKey: []
+      };
+    },
+    watch: {
+      // 这个需要用深度监听,不然回显有时会失效
+      value: {
+        handler(val) {
+          this.valueId = this.value;
+          this.initHandle();
+        },
+        deep: true,
+        immediate: true
+      },
+      options: {
+        handler(val) {
+          this.initHandle();
+        },
+        deep: true,
+        immediate: true
+      },
+      initStr: {
+        handler(newVal, oldVal) {
+          if (this.initStr) {
+            // console.log(newVal);
+            this.valueTitle = newVal;
+          }
+        },
+        immediate: true
+      }
+    },
+    // mounted() {
+    //   this.valueId = this.value; // 初始值
+    //   setTimeout(() => {
+    //     this.initHandle();
+    //   },300)
+    // },
+    methods: {
+      // 初始化值
+      async initHandle() {
+        if (this.valueId) {
+          this.$nextTick(async () => {
+            const tempValue = await this.$refs.selectTree.getNode(this.valueId);
+            setTimeout(() => {
+              if (tempValue) {
+                this.valueTitle = tempValue.data[this.props.label]; // 初始化显示
+                this.$refs.selectTree.setCurrentKey(this.valueId); // 设置默认选中
+                this.defaultExpandedKey = [this.valueId]; // 设置默认展开
+              }
+            }, 300);
+          });
+        } else {
+          this.valueTitle = '';
+        }
+        this.initScroll();
+      },
+      // 初始化滚动条
+      initScroll() {
+        this.$nextTick(() => {
+          let scrollWrap = document.querySelectorAll(
+            '.el-scrollbar .el-select-dropdown__wrap'
+          )[0];
+          let scrollBar = document.querySelectorAll(
+            '.el-scrollbar .el-scrollbar__bar'
+          );
+          scrollWrap.style.cssText =
+            'margin: 0px; max-height: none; overflow: hidden;';
+          scrollBar.forEach((ele) => (ele.style.width = 0));
+        });
+      },
+      // 切换选项
+      handleNodeClick(node) {
+        // 多选
+        if (this.multiple) {
+          let valueIdList = this.valueIds.split(',');
+          if (!valueIdList.includes(node[this.props.value])) {
+            this.valueTitle += this.valueTitle
+              ? `,${node[this.props.label]}`
+              : `${node[this.props.label]}`;
+            this.valueId = node[this.props.value];
+            this.valueIds += this.valueIds
+              ? `,${node[this.props.value]}`
+              : `${node[this.props.value]}`;
+            this.$emit('getValue', node, this.valueIds, this.valueTitle);
+            this.defaultExpandedKey = [];
+          }
+          return;
+        }
+        this.valueTitle = node[this.props.label];
+        this.valueId = node[this.props.value];
+        this.$emit('getValue', node);
+        this.defaultExpandedKey = [];
+        this.$refs.test.handleClose();
+      },
+      // 清除选中
+      clearHandle() {
+        this.valueTitle = '';
+        this.valueId = null;
+        this.valueIds = '';
+        this.defaultExpandedKey = [];
+        // this.clearSelected()
+        this.treeKey = !this.treeKey;
+        this.$emit('getValue', null);
+      },
+      // 清空选中样式
+      clearSelected() {
+        let allNode = document.querySelectorAll('#tree-option .el-tree-node');
+        allNode.forEach((element) => element.classList.remove('is-current'));
+      }
+    }
+  };
+</script>
+<style scoped>
+  .el-scrollbar .el-scrollbar__view .el-select-dropdown__item {
+    height: auto;
+    max-height: 274px;
+    padding: 0;
+    overflow: hidden;
+    overflow-y: auto;
+  }
+  .el-select-dropdown__item.selected {
+    font-weight: normal;
+  }
+  ul li >>> .el-tree .el-tree-node__content {
+    height: auto;
+    padding: 0 20px;
+  }
+  .el-tree-node__label {
+    font-weight: normal;
+  }
+  .el-tree >>> .is-current .el-tree-node__label {
+    color: #1890ff;
+    font-weight: 700;
+  }
+  .el-tree >>> .is-current .el-tree-node__children .el-tree-node__label {
+    color: #606266;
+    font-weight: normal;
+  }
+</style>

+ 27 - 36
src/views/classifyManage/treeClassify/components/list-edit.vue

@@ -27,10 +27,10 @@
             placeholder="请输入"
           />
         </el-form-item>
-        <el-form-item label="分类组:" prop="type" >
+        <el-form-item label="分类组:" prop="type">
           <el-select
             clearable
-            multiple 
+            multiple
             class="w100"
             :maxlength="20"
             v-model="type"
@@ -43,7 +43,7 @@
               :value="item.value"
             >
             </el-option>
-          </el-select> 
+          </el-select>
         </el-form-item>
 
         <el-form-item label="排序:" prop="sortNum">
@@ -54,7 +54,6 @@
           />
         </el-form-item>
 
-
         <el-form-item label="编码规则:" prop="ruleCode">
           <el-input
             clearable
@@ -77,7 +76,6 @@
       <!-- 子节点 -->
       <template v-else>
         <el-form-item label="父级节点:">
-        
           {{ parentData.name }}
         </el-form-item>
         <el-form-item label="层级全览:">
@@ -108,7 +106,7 @@
           >
           </DictSelection>
         </el-form-item>
-    
+
         <el-form-item label="本层排序:" prop="sortNum">
           <el-input
             clearable
@@ -141,7 +139,7 @@
       }
     },
     mixins: [dictMixins],
-    data () {
+    data() {
       const defaultForm = {
         name: '',
         code: '',
@@ -150,7 +148,7 @@
         sortNum: '',
         remark: '',
         parentId: 0,
-        rootCategoryLevelId: null,
+        rootCategoryLevelId: null
       };
       return {
         visible: false,
@@ -159,31 +157,28 @@
         formData: { ...defaultForm },
         type: null,
         typeList: [
-          { 
+          {
             value: '1',
             label: '物品组'
           },
 
-          { 
+          {
             value: '2',
             label: '仓储组'
           },
 
-          { 
+          {
             value: '3',
             label: '物料组'
           },
-          { 
+          {
             value: '4',
             label: '资产组'
           },
-
-          { 
+          {
             value: '5',
             label: '物品组(去产品)'
-          },
-     
-        
+          }
         ],
 
         // 表单验证规则
@@ -201,8 +196,7 @@
               message: '请输入类型编码',
               trigger: 'blur'
             }
-          ],
-     
+          ]
         },
         // 提交状态
         loading: false,
@@ -213,7 +207,7 @@
       };
     },
     computed: {
-      fullName () {
+      fullName() {
         let str = '';
         let codeStr = '';
         let node = this.curNode;
@@ -229,16 +223,16 @@
         );
       }
     },
-    created () {},
+    created() {},
     methods: {
-      open (data, parentData) {
-        this.formData.rootCategoryLevelId = this.$route.query.id
+      open(data, parentData) {
+        this.formData.rootCategoryLevelId = this.$route.query.id;
         this.parentData = parentData;
         this.data = data;
         this.visible = true;
       },
       /* 保存编辑 */
-      save () {
+      save() {
         this.$refs.formRef.validate((valid) => {
           if (!valid) {
             return false;
@@ -249,18 +243,15 @@
           if (!this.data?.id && this.parentData?.id) {
             params.parentId =
               this.rootId == this.data?.id ? 0 : this.parentData.id;
-          
-
           }
           if (this.data?.id) {
             params.id = this.data.id;
-           
           }
-          if(!this.rootId || ( this.data &&  this.data.id ==  this.rootId)) {
-             if(this.type) {
-              params.type = this.type.join(',')
-             }
-            params.parentId = 0
+          if (!this.rootId || (this.data && this.data.id == this.rootId)) {
+            if (this.type) {
+              params.type = this.type.join(',');
+            }
+            params.parentId = 0;
           }
 
           saveOrUpdate(params)
@@ -277,17 +268,17 @@
         });
       },
       /* 更新visible */
-      updateVisible (value) {
+      updateVisible(value) {
         this.visible = value;
       }
     },
     watch: {
-      visible (visible) {
+      visible(visible) {
         if (visible) {
           if (this.data) {
             this.$util.assignObject(this.formData, this.data);
-            console.log(this.data)
-            this.type = this.data.type.split(',')
+            console.log(this.data);
+            this.type = this.data.type.split(',');
             this.isUpdate = true;
           } else {
             this.isUpdate = false;

+ 512 - 0
src/views/rulesManagement/Inventory/components/AssetsInWarehouse.vue

@@ -0,0 +1,512 @@
+<template>
+  <div class="assets-container" v-show="assetsName">
+    <div class="tree-wrapper">
+      <div class="title">
+        {{ assetsName }}
+        <el-checkbox
+          :value="assetsSelectAll"
+          @click.native.prevent="handleAssetsSelectAll"
+          :disabled="isBindPlan"
+        ></el-checkbox>
+      </div>
+      <div class="scroll-wrapper">
+        <el-tree
+          show-checkbox
+          :data="treeList"
+          :props="{
+            children: 'children',
+            value: 'code',
+            label: 'name'
+          }"
+          :filter-node-method="filterNode"
+          v-loading="treeLoading"
+          node-key="id"
+          ref="treeRef"
+          :default-expanded-keys="defaultExpandedKeys"
+          :highlight-current="true"
+          @node-click="handleNodeClick"
+          @check="clickCheck"
+        >
+          <span class="custom-tree-node" slot-scope="{ node, data }">
+            <span>{{ node.label }}</span>
+          </span>
+        </el-tree>
+      </div>
+    </div>
+    <div :class="isBindPlan ? 'table-wrapper' : 'table-box'">
+      <el-table
+        style="width: 100% !important"
+        height="400px"
+        ref="tableRef"
+        :data="tableData"
+        @selection-change="handleSelectionChange"
+        @select="handleCurSelectionChange"
+        :key="assetsName"
+        :header-cell-style="{
+          background: '#F0F3F3',
+          border: 'none'
+        }"
+        :disabled="isBindPlan"
+      >
+        <el-table-column
+          v-for="item in tableInfoData"
+          :key="item.key"
+          :prop="item.inKey"
+          :label="item.label"
+          :width="item.width"
+        >
+        </el-table-column>
+        <el-table-column
+          type="selection"
+          :selectable="selectable"
+          :width="tableData.length ? '55' : '500'"
+        >
+        </el-table-column>
+      </el-table>
+    </div>
+  </div>
+</template>
+
+<script>
+  import { mapGetters } from 'vuex';
+  import { tableContentData } from './tableContentData.js';
+  export default {
+    props: {
+      assetsName: {
+        type: String,
+        default: ''
+      },
+      warehouseId: {
+        type: [Number, String],
+        default: ''
+      },
+      tableValuableList: {
+        type: Array,
+        default: () => []
+      },
+      assetsType: {
+        type: [String, Number],
+        default: ''
+      },
+      assetSubType: {
+        type: [String, Number],
+        default: ''
+      },
+      planRuleInventoryDetailList: {
+        type: Array,
+        default: []
+      },
+      isBindPlan: {
+        type: Boolean,
+        default: function () {
+          return false;
+        }
+      }
+    },
+    computed: {
+      ...mapGetters(['addOrUpdate'])
+    },
+    watch: {
+      // warehouseId() {
+      //   if (this.curNode) {
+      //     this.getTableInfo(
+      //       this.curNode.data.id === this.curNode.data.originId
+      //         ? ""
+      //         : this.curNode.data.id
+      //     );
+      //   }
+      // },
+      planRuleInventoryDetailList(val) {
+        console.log('asd', val);
+        if (val) {
+          this.$nextTick(() => {
+            val.forEach((item) => {
+              if (!this.tableSelectionList[item.bizTypeId]) {
+                this.tableSelectionList[item.bizTypeId] = [item];
+              } else {
+                this.tableSelectionList[item.bizTypeId].push(item);
+              }
+            });
+            this.handleAssetsChange();
+          });
+        }
+      }
+    },
+    data() {
+      return {
+        treeList: [],
+        tableInfoData: [],
+        tableData: [],
+        requestApi: '',
+        treeLoading: false,
+        tableSelectionList: {},
+        assetsSelectionList: [],
+        assetsSelectAll: false,
+        curNode: null,
+        defaultExpandedKeys: [],
+        changeData: [],
+        isChecked: false
+      };
+    },
+    mounted() {
+      this.$nextTick(() => {
+        this.handleAssetsChange();
+      });
+    },
+    created() {
+      // console.log('库内')
+      // if(this.planRuleInventoryDetailList){
+      //   console.log('this.planRuleInventoryDetailList',this.planRuleInventoryDetailList)
+      //   this.tableData = this.planRuleInventoryDetailList
+      // }
+    },
+    methods: {
+      //表格复选框禁用
+      selectable(row, rowIndex) {
+        if (this.isBindPlan) {
+          return false;
+        } else {
+          return true;
+        }
+      },
+      // 重置
+      resetData() {
+        this.clearSelection();
+        this.treeList = [];
+      },
+      //清除选中
+      clearSelection() {
+        this.assetsSelectAll = false;
+        this.tableData = [];
+        this.tableSelectionList = {};
+      },
+      //派单过滤
+      filterNode(value, data, node) {
+        return (
+          this.tableValuableList.findIndex(
+            (item) => item.bizTypeId === data.id
+          ) !== -1
+        );
+      },
+      getSelectList() {
+        const classificationList =
+          (this.$refs.treeRef && this.$refs.treeRef.getCheckedNodes()) || [];
+        const list = Object.values(this.tableSelectionList) || [];
+        var arr = [];
+        list.map((item, index) => {
+          for (var i = 0; i < item.length; i++) {
+            arr.push(item[i]);
+          }
+        });
+        const tableSelectionList = arr;
+        return {
+          classificationList,
+          tableSelectionList
+          // tableSelectionList: Object.values(this.tableSelectionList)
+          //   .flat()
+          //   .filter(
+          //     // i => !classificationList.find(itm => i.classificationId == itm.id)
+          //      i => !classificationList.find(itm => i.bizTypeId == itm.id)
+          //   )
+          //   .map(item => {
+          //     item.minPackUnit = item.minPackUtil
+          //     return item
+          //   })
+        };
+      },
+      handleAssetsChange() {
+        setTimeout(() => {
+          if (this.assetsName) {
+            let obj = tableContentData.find(
+              (item) => item.name === this.assetsName
+            );
+            this.tableInfoData = (obj && obj.tableData) || [];
+            this._getTreeList();
+            // this.clearSelection()
+          }
+        }, 0);
+      },
+      // 设备、舟皿、周转车、模具
+      async _getTreeList() {
+        let res = await classManagement.getClassificationTreeAsyncCall({
+          id: '0',
+          type: this.assetsType
+        });
+        if (res?.success) {
+          this.treeList = res.data[0]?.children || [];
+          if (this.isBindPlan) {
+            this.deepEach(this.treeList);
+          }
+          if (this.tableValuableList?.length) {
+            this.$nextTick(() => {
+              this.$refs.treeRef.filter();
+            });
+          }
+
+          if (this.addOrUpdate === 'edit') {
+            let keys = [];
+            this.planRuleInventoryDetailList.map((item) => {
+              if (item.bizTypeId !== null) {
+                keys.push(item.bizTypeId);
+              }
+            });
+            keys = [...new Set(keys)];
+            this.defaultExpandedKeys = keys;
+            if (keys.length) {
+              this.$nextTick(() => {
+                this.$refs.treeRef.setCurrentKey(keys[0]);
+                this.convertTreeData();
+                let chooseData = null;
+                this.changeData.map((item) => {
+                  if (item.id == keys[0]) {
+                    chooseData = item;
+                  }
+                });
+                if (chooseData) {
+                  this.getTableInfo(chooseData.id);
+                }
+                //    this.handleNodeClick(chooseData,node)
+              });
+            }
+          }
+        }
+      },
+      handleNodeClick(data, node) {
+        console.log(node, 'node');
+        if (!node.isLeaf) return; //限制叶子节点
+        this.curNode = node;
+        // this.getTableInfo(data.id === data.originId ? '' : data.id)
+        this.getTableInfo({
+          assetType: data.type,
+          classificationIds: [data.id]
+        });
+      },
+      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;
+      },
+
+      async getTableInfo(assetSubType) {
+        const params = {
+          page: 1,
+          size: 9999,
+          ...assetSubType
+        };
+
+        if (assetSubType) {
+          params.assetSubType = assetSubType;
+        }
+        const res = await getgoodspage(params);
+        if (res?.success) {
+          if (this.tableValuableList && this.tableValuableList.length) {
+            // 派单过滤
+            this.tableData = res.data.records
+              .filter(
+                (item) =>
+                  this.tableValuableList.findIndex(
+                    (i) => i.assetId == item.id
+                  ) !== -1
+              )
+              .map((i, index) => ({
+                ...i,
+                index,
+                classificationId: assetSubType
+              }));
+          } else {
+            this.tableData = res.data.records.map((i, index) => ({
+              ...i,
+              index,
+              classificationId: assetSubType
+            }));
+          }
+          const checkedTrees = this.$refs.treeRef.getCheckedKeys();
+
+          // if(this.addOrUpdate === 'edit'){
+          //   this.defaultExpandedKeys
+          // }
+          this.$nextTick(() => {
+            //分类选中
+            this.tableData.map((item) => {
+              if (checkedTrees.includes(item.classificationId + '')) {
+                this.$refs.tableRef.toggleRowSelection(item);
+              }
+            });
+            // 表格选中(切换保存状态
+            for (const key in this.tableSelectionList) {
+              this.tableSelectionList[key].forEach((item) => {
+                const row = this.tableData.find((i) => i.id === item.id);
+                if (row) {
+                  //this.$refs.tableRef.toggleRowSelection(row, true)
+                }
+              });
+            }
+          });
+
+          if (this.addOrUpdate === 'edit') {
+            if (this.planRuleInventoryDetailList) {
+              this.tableData.map((item) => {
+                for (
+                  var i = 0;
+                  i < this.planRuleInventoryDetailList.length;
+                  i++
+                ) {
+                  if (item.id == this.planRuleInventoryDetailList[i].id) {
+                    this.$nextTick(() => {
+                      this.$refs.tableRef.toggleRowSelection(item, true);
+                    });
+                  }
+                }
+              });
+            }
+          }
+        }
+      },
+
+      // tree选中状态改变
+      clickCheck(data, checkinfo) {
+        const isChecked = checkinfo.checkedKeys.indexOf(data.id) > -1;
+
+        if (!isChecked) {
+          //取消全选
+          this.assetsSelectAll = false;
+        }
+
+        if (this.curNode && this.curNode.data.id === data.id) {
+          this.tableData.forEach((row) => {
+            this.$refs.tableRef.toggleRowSelection(row, isChecked);
+          });
+        }
+      },
+
+      // 资产分类全选  通过点击事件更改状态
+      handleAssetsSelectAll() {
+        if (this.isBindPlan) return;
+        this.assetsSelectAll = !this.assetsSelectAll;
+        if (this.assetsSelectAll) {
+          const keys = this.treeList.map((item) => item.id);
+          this.$refs.treeRef.setCheckedKeys(keys);
+        } else {
+          this.$refs.treeRef.setCheckedKeys([]);
+        }
+      },
+      handleSelectionChange(val) {
+        console.log(val);
+        let bizType = {};
+        if (this.curNode) {
+          bizType = {
+            bizTypeId: this.curNode.data?.id,
+            bizTypeName: this.curNode.data?.name
+          };
+          this.$set(
+            this.tableSelectionList,
+            this.curNode.data.id,
+            val.map((i) => ({
+              ...i,
+              ...bizType
+            }))
+          );
+        }
+        if (val.length > 0 && val.length === this.tableData.length) {
+          //全选
+          this.$refs.treeRef.setChecked(val[0].classificationId, true);
+        }
+        if (val.length === 0 && this.tableData.length > 0) {
+          //全不选
+          this.$refs.treeRef.setChecked(
+            this.tableData[0].classificationId,
+            false
+          );
+        }
+      },
+      handleCurSelectionChange(selection, row) {
+        if (selection.findIndex((item) => item.index === row.index) === -1) {
+          //取消选中
+          this.$refs.treeRef.setChecked(row.classificationId, false);
+
+          for (const key in this.tableSelectionList) {
+            const idx = this.tableSelectionList[key].findIndex(
+              (item) => item.id === row.id
+            );
+            if (idx !== -1) {
+              this.tableSelectionList[key].splice(idx, 1);
+            }
+          }
+        }
+      },
+
+      convertTreeData() {
+        this.changeData = this.treeList;
+        for (let i = 0; i < this.changeData.length; i++) {
+          if (this.changeData[i].children != undefined) {
+            const temp = this.changeData[i].children;
+            delete this.changeData[i].children;
+            this.changeData = this.changeData.concat(temp);
+          }
+        }
+      },
+
+      // 子节点处理
+      deepEach(arr) {
+        arr.forEach((item) => {
+          item.disabled = true;
+          if (item.children) {
+            this.deepEach(item.children); // 递归
+          }
+        });
+      }
+    }
+  };
+</script>
+
+<style scoped lang="scss">
+  ::v-deep .table-wrapper .el-table__header-wrapper .el-checkbox {
+    display: none;
+  }
+  ::v-deep.assets-container {
+    display: flex;
+    width: 100%;
+    .el-tree-node__content > .el-checkbox {
+      position: absolute;
+      right: 0;
+    }
+    .tree-wrapper {
+      // width: 350px;
+      width: 30%;
+      margin-right: 12px;
+      border: 1px solid #ccc;
+
+      .title {
+        text-align: center;
+        font-size: 16px;
+        font-weight: bold;
+        background: #f0f3f3;
+        padding: 4px;
+        padding-right: 8px;
+        .el-checkbox {
+          float: right;
+        }
+      }
+      .scroll-wrapper {
+        padding-top: 8px;
+      }
+    }
+    .table-wrapper {
+      width: 70%;
+      padding: 8px;
+      border: 1px solid #ccc;
+    }
+
+    .table-box {
+      width: 70%;
+      padding: 8px;
+      border: 1px solid #ccc;
+    }
+  }
+</style>

+ 204 - 14
src/views/rulesManagement/planRules/components/addInventoryDialog.vue → src/views/rulesManagement/Inventory/components/addInventoryDialog.vue

@@ -87,7 +87,7 @@
             </el-select>
           </el-form-item>
         </el-col>
-        <el-col v-if="addForm.inventoryType == 2" :span="8">
+        <!-- <el-col v-if="addForm.inventoryType == 2" :span="8">
           <el-form-item label="所属厂房:" prop="plantId">
             <el-select
               v-model="addForm.plantId"
@@ -164,7 +164,7 @@
               </el-option>
             </el-select>
           </el-form-item>
-        </el-col>
+        </el-col> -->
         <el-col v-if="addForm.inventoryType == 1" :span="8">
           <el-form-item label="盘点仓库" prop="warehouseId">
             <el-select
@@ -219,7 +219,10 @@
           </el-form-item>
         </el-col>
         <el-col :span="8">
-          <el-form-item label="分类" prop="categoryLevelId">
+          <el-form-item
+            :label="type == 2 ? '产品分类' : '资产分类'"
+            prop="categoryLevelId"
+          >
             <!-- <DictSelection
               dictName="类型用途"
               clearable
@@ -323,6 +326,73 @@
           </el-form-item>
         </el-col>
       </el-row>
+      <ele-pro-table
+        ref="table"
+        class="table"
+        :columns="newColumns"
+        :datasource="datasource"
+        :selection.sync="selection"
+        :initLoad="false"
+        height="500px"
+        tool-class="ele-toolbar-form"
+        cache-key="systemOrgUserTable"
+      >
+        <!-- 表头工具栏 -->
+        <template v-slot:toolbar="{ row }">
+          <el-input
+            style="width: 400px"
+            placeholder="请输入名称/编码/批次号/型号/规格"
+            v-model="keyWord"
+            class="input-with-select"
+          >
+            <el-button
+              slot="append"
+              icon="el-icon-search"
+              type="primary"
+              @click="reload"
+              >搜索</el-button
+            >
+          </el-input>
+        </template>
+        <!-- 最小包装单元 -->
+        <template v-slot:minPackingCount="{ row }">
+          <span v-if="row.minPackingCount">
+            {{ row.minPackingCount }}
+            {{ row.measuringUnit }}/{{ row.minUnit }}
+          </span>
+        </template>
+        <!-- 库存保质期 -->
+        <template v-slot:expirationDate="{ row }">
+          <span v-if="row.expirationDate">
+            {{ row.expirationDate ? row.expirationDate : '-' }}
+            {{
+              row.expirationDateUnit == 'year'
+                ? '年'
+                : row.expirationDateUnit == 'month'
+                ? '月'
+                : '日'
+            }}
+          </span>
+        </template>
+        <!-- 质检状态 -->
+        <template v-slot:qualityStatus="{ row }">
+          <span v-if="row.qualityResult == 0 || row.qualityResult == 1"
+            >已检</span
+          >
+          <span v-else-if="row.qualityStatus == 1">已检</span>
+          <span v-else-if="row.qualityStatus == 0">未检</span>
+          <span v-else>-</span>
+        </template>
+        <!-- 质检结果 -->
+        <template v-slot:qualityResult="{ row }">
+          <span v-if="row.qualityResult == 0 || row.qualityResult == ''"
+            >合格</span
+          >
+          <span v-else-if="row.qualityResult == 1">不合格</span>
+          <span v-else-if="row.qualityResult == 3">让步接收</span>
+          <span v-else>-</span>
+        </template>
+      </ele-pro-table>
       <!-- 库外 -->
       <!-- <Assets
         ref="assetsRef"
@@ -367,11 +437,13 @@
   import { listByProductionLineId } from '@/api/workforceManagement/team';
   import selectTree from '@/components/selectTree';
   import { getTreeByGroup } from '@/api/classifyManage';
+  import { getProductList } from '@/api/ruleManagement/plan';
   import { inventoryTypeStatus } from '@/utils/dict/rulesManagement';
   import { mapGetters } from 'vuex';
   // import { wh_checkStatus} from '@/utils/dict/warehouse'
   import { getCode } from '@/api/ruleManagement/matter';
   import AssetsInWarehouse from './AssetsInWarehouse';
+  import { fieldModel } from '@/api/codeManagement';
   import {
     getRule,
     getWarehouseList,
@@ -405,6 +477,7 @@
     },
     data() {
       return {
+        type: 2, // 盘点类型 2仓储 4资产
         factoryOptions: [],
         workshopOptions: [],
         productionLineOptions: [],
@@ -419,6 +492,86 @@
         executorList: [], // 执行人
         assetsType: null,
         planRuleInventoryDetailList: [],
+        tableList: [],
+        newColumns: [],
+        selection: [],
+        keyWord: '',
+        columns: [
+          {
+            columnKey: 'selection',
+            type: 'selection',
+            width: 45,
+            align: 'center',
+            fixed: 'left'
+          },
+          {
+            columnKey: 'index',
+            type: 'index',
+            width: 50,
+            align: 'center',
+            label: '序号',
+            showOverflowTooltip: true,
+            fixed: 'left'
+          },
+          {
+            prop: 'categoryCode',
+            label: '物品编码',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'categoryName',
+            label: '物品名称',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'brandNum',
+            label: '牌号',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'categoryModel',
+            label: '型号',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'specification',
+            label: '规格',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'level',
+            label: '级别',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'measureQuantity',
+            label: '计量数量',
+            sortable: 'custom',
+            showOverflowTooltip: true,
+            width: 130,
+            align: 'center'
+          },
+          {
+            prop: 'measureUnit',
+            label: '计量单位',
+            align: 'center'
+          },
+          {
+            prop: 'weight',
+            label: '重量',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'weightUnit',
+            label: '重量单位',
+            showOverflowTooltip: true
+          }
+        ],
         addForm: {
           code: '', // 计划配置单号
           planName: '', // 计划配置名称
@@ -504,7 +657,7 @@
           // 获取规则名称
           this._getRuleNameList();
           // 获取物品类型
-          this.getGoodsList();
+          // this.getGoodsList();
           // 获取工厂列表
           this.getFactoryareaList();
           if (
@@ -593,15 +746,46 @@
       }
     },
     computed: {
-      // ...mapGetters([
-      //   'equipmentList',
-      //   // 'ruleNameList',
-      //   'planRulesDetails',
-      //   'addDialogLoading',
-      //   'addOrUpdate'
-      // ])
+      clientEnvironmentId() {
+        return this.$store.state.user.info.clientEnvironmentId;
+      }
+    },
+    created() {
+      this.getFieldModel();
     },
     methods: {
+      getFieldModel() {
+        fieldModel({ relevance: 't_main_category' }).then((res) => {
+          let newRes = res.map((m) => {
+            return {
+              prop: 'extField.' + m.prop,
+              label: m.label,
+              align: 'center',
+              showOverflowTooltip: true
+            };
+          });
+
+          this.newColumns = [...this.columns, ...newRes];
+
+          this.$forceUpdate();
+        });
+      },
+      reload() {
+        this.$refs.table.reload();
+      },
+      /* 表格数据源 */
+      datasource({ page, limit, where, order }) {
+        const data = getProductList({
+          ...where,
+          ...order,
+          keyWord: this.keyWord,
+          warehouseId: this.type == 2 ? this.addForm?.warehouseId : '',
+          categoryLevelId: this.addForm?.categoryLevelId,
+          pageNum: page,
+          size: limit
+        });
+        return data;
+      },
       // 改变规则名称
       change_ruleId(val) {
         this.addForm.ruleName = this.ruleNameList.filter(
@@ -674,14 +858,15 @@
         )[0].name;
       },
       // 物品类型选择
-      codeListValue(val) {
+      async codeListValue(val) {
         console.log('val---------', val);
         this.addForm.categoryLevelId = val?.id;
         this.addForm.categoryLevelName = val?.name;
+        this.$refs.table.reload();
       },
       // 获取物品类型列表
       async getGoodsList() {
-        const { data } = await getTreeByGroup({ type: 2 });
+        const { data } = await getTreeByGroup({ type: this.type });
         this.codeList = data;
       },
       // 获取规则名列表
@@ -845,10 +1030,13 @@
       // x选择盘点类型
       chooseType(val) {
         if (val == 2) {
+          // 库外盘点
           this.addForm.warehouseId = '';
           this.addForm.warehouseName = '';
           this.addForm.lockWarehouse = 0;
+          this.type = 4;
         } else {
+          // 库内盘点
           this.addForm.plantId = '';
           this.addForm.workshopId = '';
           this.addForm.productionLineId = '';
@@ -856,9 +1044,11 @@
           this.workshopOptions = [];
           this.productionLineOptions = [];
           this.stationOptions = [];
+          this.type = 2;
         }
+        this.addForm.categoryLevelId = '';
+        this.getGoodsList();
       },
-
       // 提交
       submit() {
         console.log(this.addForm);

+ 0 - 0
src/views/rulesManagement/planRules/components/inventory-search.vue → src/views/rulesManagement/Inventory/components/inventory-search.vue


+ 90 - 0
src/views/rulesManagement/Inventory/components/tableContentData.js

@@ -0,0 +1,90 @@
+// 盘点
+export const tableContentData = [
+  {
+    name: '原料',
+    tableData: [
+      { label: '物品编码', key: 'informationCode', inKey: 'informationCode' },
+      { label: '物品名称', key: 'informationName', inKey: 'informationName' },
+      { label: '牌号', key: 'brandNum', inKey: 'brandNum' }
+    ]
+  },
+  {
+    name: '耗材',
+    tableData: [
+      { label: '物品编码', key: 'informationCode', inKey: 'informationCode' },
+      { label: '物品名称', key: 'informationName', inKey: 'informationName' },
+      { label: '规格', key: 'specification', inKey: 'specification' },
+      { label: '型号', key: 'modelType', inKey: 'modelType' }
+    ]
+  },
+  {
+    name: '物料',
+    tableData: [
+      { label: '物品编码', key: 'informationCode', inKey: 'informationCode' },
+      { label: '物品名称', key: 'informationName', inKey: 'informationName' },
+      { label: '规格', key: 'specification', inKey: 'specification' },
+      { label: '型号', key: 'modelType', inKey: 'modelType' }
+    ]
+  },
+  {
+    name: '产品',
+    tableData: [
+      { label: '物品编码', key: 'informationCode', inKey: 'informationCode' },
+      { label: '物品名称', key: 'informationName', inKey: 'informationName' },
+      { label: '牌号', key: 'brandNum', inKey: 'brandNum' },
+      { label: '型号', key: 'modelType', inKey: 'modelType' }
+    ]
+  },
+  {
+    name: '周转车',
+    tableData: [
+      { label: '物品编码', key: 'informationCode', inKey: 'informationCode' },
+      { label: '物品名称', key: 'informationName', inKey: 'informationName' },
+      { label: '规格', key: 'specification', inKey: 'specification' },
+      { label: '材质', key: 'specification', inKey: 'specification' },
+      { label: '长/宽/高', key: 'ckg', inKey: 'ckg' }
+    ]
+  },
+  {
+    name: '舟皿',
+    tableData: [
+      { label: '物品编码', key: 'informationCode', inKey: 'informationCode' },
+      { label: '物品名称', key: 'informationName', inKey: 'informationName' },
+      { label: '规格', key: 'specification', inKey: 'specification' },
+      { label: '型号', key: 'modelType', inKey: 'modelType' },
+      { label: '长/宽/高', key: 'ckg', inKey: 'ckg' }
+    ]
+  },
+  {
+    name: '生产设备',
+    tableData: [
+      { label: '物品编码', key: 'informationCode', inKey: 'informationCode' },
+      { label: '物品名称', key: 'informationName', inKey: 'informationName' },
+      { label: '规格', key: 'specification', inKey: 'specification' },
+      { label: '型号', key: 'modelType', inKey: 'modelType' }
+    ]
+  },
+  {
+    name: '模具',
+    tableData: [
+      { label: '物品编码', key: 'informationCode', inKey: 'informationCode' },
+      { label: '物品名称', key: 'informationName', inKey: 'informationName' },
+      { label: '规格', key: 'specification', inKey: 'specification' },
+      { label: '型号', key: 'modelType', inKey: 'modelType' },
+      {
+        label: '收缩系数',
+        key: 'shrinkageCoefficient',
+        inKey: 'shrinkageCoefficient'
+      }
+    ]
+  },
+  {
+    name: '备品备件',
+    tableData: [
+      { label: '物品编码', key: 'informationCode', inKey: 'informationCode' },
+      { label: '物品名称', key: 'informationName', inKey: 'informationName' },
+      { label: '规格', key: 'specification', inKey: 'specification' },
+      { label: '型号', key: 'modelType', inKey: 'modelType' }
+    ]
+  }
+];

+ 227 - 0
src/views/rulesManagement/Inventory/index.vue

@@ -0,0 +1,227 @@
+<template>
+  <div class="ele-body">
+    <el-card shadow="never" v-loading="loading">
+      <inventory-search ref="inventorySearch" @search="reload">
+      </inventory-search>
+      <!-- 数据表格 -->
+      <ele-pro-table
+        ref="table"
+        :columns="columns"
+        :datasource="datasource"
+        cache-key="systemRoleTable14"
+      >
+        <!-- 表头工具栏 -->
+        <template v-slot:toolbar="{ row }">
+          <el-button
+            size="small"
+            type="primary"
+            icon="el-icon-plus"
+            class="ele-btn-icon"
+            @click="openEdit()"
+          >
+            新建
+          </el-button>
+        </template>
+        <!-- 操作列 -->
+        <template v-slot:action="{ row }">
+          <el-link
+            type="primary"
+            :underline="false"
+            icon="el-icon-edit"
+            @click="openEdit(row)"
+          >
+            修改
+          </el-link>
+          <el-link type="primary" class="ele-btn-icon" @click="goDetail(row)">
+            详情
+          </el-link>
+          <el-popconfirm
+            class="ele-action"
+            title="确定要删除此角色吗?"
+            @confirm="remove(row)"
+          >
+            <template v-slot:reference>
+              <el-link type="danger" :underline="false" icon="el-icon-delete">
+                删除
+              </el-link>
+            </template>
+          </el-popconfirm>
+        </template>
+      </ele-pro-table>
+    </el-card>
+    <!-- 新建或编辑弹窗 -->
+    <AddInventoryDialog
+      ref="addInventoryDialogRef"
+      :dialogTile="dialogTitle"
+      :id="inventoryId"
+      @refreshList="resetForm"
+      :isBindPlan="isBindPlan"
+    />
+  </div>
+</template>
+
+<script>
+  import { deleteStocktakingPlan } from '@/api/ruleManagement/plan';
+  import { getInventoryList } from '@/api/ruleManagement/plan';
+  import InventorySearch from './components/inventory-search.vue';
+  import AddInventoryDialog from './components/addInventoryDialog.vue';
+  export default {
+    components: {
+      InventorySearch,
+      AddInventoryDialog
+    },
+    data() {
+      return {
+        inventoryId: '',
+        // 表格列配置
+        columns: [
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true,
+            fixed: 'left'
+          },
+          {
+            prop: 'planCode',
+            label: '计划单号',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'planName',
+            label: '盘点名称',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'warehouseName',
+            label: '盘点仓库',
+            align: 'center',
+            showOverflowTooltip: true,
+            slot: 'enable',
+            minWidth: 110
+          },
+          {
+            prop: 'executeGroupName',
+            label: '盘点部门',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'categoryLevelName',
+            label: '资产分类',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'ruleName',
+            label: '规则名称',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'autoOrder',
+            label: '自动派单',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110,
+            formatter: (row) => {
+              return { 0: '否', 1: '是' }[row.autoOrder];
+            }
+          },
+          {
+            prop: 'enable',
+            label: '状态',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110,
+            formatter: (row) => {
+              return { 0: '失效', 1: '生效' }[row.enable];
+            }
+          },
+          {
+            prop: 'createUserName',
+            label: '创建人',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'createTime',
+            label: '创建时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110,
+            formatter: (_row, _column, cellValue) => {
+              return this.$util.toDateString(cellValue);
+            }
+          },
+          {
+            columnKey: 'action',
+            label: '操作',
+            width: 200,
+            align: 'center',
+            resizable: false,
+            slot: 'action',
+            showOverflowTooltip: true
+          }
+        ],
+        // 加载状态
+        loading: false,
+        dialogTitle: '',
+        isBindPlan: false
+      };
+    },
+    methods: {
+      // 重置
+      resetForm() {
+        this.$refs.inventorySearch.reset();
+        // this.$refs.configFormRef.resetFields();
+        // this.searchForm()
+      },
+      /* 表格数据源 */
+      datasource({ page, limit, where, order }) {
+        return getInventoryList({ pageNum: page, size: limit, ...where });
+      },
+      /* 刷新表格 */
+      reload(where) {
+        this.$refs.table.reload({ page: 1, where });
+      },
+      remove(row) {
+        deleteStocktakingPlan([row.id]).then((res) => {
+          console.log(res);
+          if (res.code == 0) {
+            this.$message.success('删除成功');
+            this.$refs.inventorySearch.reset();
+          }
+        });
+      },
+      openEdit(row) {
+        if (row) {
+          this.dialogTitle = '修改盘点计划配置';
+          this.inventoryId = row.id;
+        } else {
+          this.dialogTitle = '新增盘点计划配置';
+          this.inventoryId = '';
+        }
+        this.isBindPlan = false;
+        this.$refs.addInventoryDialogRef.dialogVisible = true;
+        // this.$store.dispatch('planRules/setAddOrUpdate', 'add')
+      },
+      goDetail(row) {
+        this.dialogTitle = '盘点计划配置详情';
+        this.inventoryId = row.id;
+        this.isBindPlan = true;
+        this.$refs.addInventoryDialogRef.dialogVisible = true;
+      }
+    }
+  };
+</script>

+ 0 - 520
src/views/rulesManagement/planRules/components/AssetsInWarehouse.vue

@@ -1,520 +0,0 @@
-<template>
-  <div class="assets-container" v-show="assetsName">
-    <div class="tree-wrapper">
-      <div class="title">
-        {{ assetsName }}
-        <el-checkbox
-          :value="assetsSelectAll"
-          @click.native.prevent="handleAssetsSelectAll"
-          :disabled="isBindPlan"
-        ></el-checkbox>
-      </div>
-      <div class="scroll-wrapper">
-        <el-tree
-          show-checkbox
-          :data="treeList"
-          :props="{
-            children: 'children',
-            value: 'code',
-            label: 'name',
-          }"
-          :filter-node-method="filterNode"
-          v-loading="treeLoading"
-          node-key="id"
-          ref="treeRef"
-          :default-expanded-keys="defaultExpandedKeys"
-          :highlight-current="true"
-          @node-click="handleNodeClick"
-          @check="clickCheck"
-        >
-          <span class="custom-tree-node" slot-scope="{ node, data }">
-            <span>{{ node.label }}</span>
-          </span>
-        </el-tree>
-      </div>
-    </div>
-    <div :class="isBindPlan ? 'table-wrapper' : 'table-box'">
-      <el-table
-        style="width: 100% !important"
-        height="400px"
-        ref="tableRef"
-        :data="tableData"
-        @selection-change="handleSelectionChange"
-        @select="handleCurSelectionChange"
-        :key="assetsName"
-        :header-cell-style="{
-          background: '#F0F3F3',
-          border: 'none',
-        }"
-        :disabled="isBindPlan"
-      >
-        <el-table-column
-          v-for="item in tableInfoData"
-          :key="item.key"
-          :prop="item.inKey"
-          :label="item.label"
-          :width="item.width"
-        >
-        </el-table-column>
-        <el-table-column
-          type="selection"
-          :selectable="selectable"
-          :width="tableData.length ? '55' : '500'"
-        >
-        </el-table-column>
-      </el-table>
-    </div>
-  </div>
-</template>
-
-<script>
-// import classManagement from "@/api/ledgerAssets/classManagement";
-// import { tableContentData } from '../../../components/enum'
-import { mapGetters } from "vuex";
-// import {
-//   getInventoryListGroup,
-//   getgoodspage,
-// } from "@/api/stockManagement/stocking";
-import { tableContentData } from "./tableContentData.js";
-export default {
-  props: {
-    assetsName: {
-      type: String,
-      default: "",
-    },
-    warehouseId: {
-      type: [Number, String],
-      default: "",
-    },
-    tableValuableList: {
-      type: Array,
-      default: () => [],
-    },
-    assetsType: {
-      type: [String, Number],
-      default: "",
-    },
-    assetSubType: {
-      type: [String, Number],
-      default: "",
-    },
-    planRuleInventoryDetailList: {
-      type: Array,
-      default: [],
-    },
-    isBindPlan: {
-      type: Boolean,
-      default: function () {
-        return false;
-      },
-    },
-  },
-  computed: {
-    ...mapGetters(["addOrUpdate"]),
-  },
-  watch: {
-    // warehouseId() {
-    //   if (this.curNode) {
-    //     this.getTableInfo(
-    //       this.curNode.data.id === this.curNode.data.originId
-    //         ? ""
-    //         : this.curNode.data.id
-    //     );
-    //   }
-    // },
-    planRuleInventoryDetailList(val) {
-      console.log('asd',val)
-      if (val) {
-        this.$nextTick(() => {
-          val.forEach((item) => {
-            if (!this.tableSelectionList[item.bizTypeId]) {
-              this.tableSelectionList[item.bizTypeId] = [item];
-            } else {
-              this.tableSelectionList[item.bizTypeId].push(item);
-            }
-          });
-          this.handleAssetsChange();
-        });
-      }
-    },
-  },
-  data() {
-    return {
-      treeList: [],
-      tableInfoData: [],
-      tableData: [],
-      requestApi: "",
-      treeLoading: false,
-      tableSelectionList: {},
-      assetsSelectionList: [],
-      assetsSelectAll: false,
-      curNode: null,
-      defaultExpandedKeys: [],
-      changeData: [],
-      isChecked: false,
-    };
-  },
-  mounted() {
-    this.$nextTick(() => {
-      this.handleAssetsChange();
-    });
-  },
-  created() {
-    // console.log('库内')
-    // if(this.planRuleInventoryDetailList){
-    //   console.log('this.planRuleInventoryDetailList',this.planRuleInventoryDetailList)
-    //   this.tableData = this.planRuleInventoryDetailList
-    // }
-  },
-  methods: {
-    //表格复选框禁用
-    selectable(row, rowIndex) {
-      if (this.isBindPlan) {
-        return false;
-      } else {
-        return true;
-      }
-    },
-    // 重置
-    resetData() {
-      this.clearSelection();
-      this.treeList = [];
-    },
-    //清除选中
-    clearSelection() {
-      this.assetsSelectAll = false;
-      this.tableData = [];
-      this.tableSelectionList = {};
-    },
-    //派单过滤
-    filterNode(value, data, node) {
-      return (
-        this.tableValuableList.findIndex(
-          (item) => item.bizTypeId === data.id
-        ) !== -1
-      );
-    },
-    getSelectList() {
-      const classificationList =
-        (this.$refs.treeRef && this.$refs.treeRef.getCheckedNodes()) || [];
-      const list = Object.values(this.tableSelectionList) || [];
-      var arr = [];
-      list.map((item, index) => {
-        for (var i = 0; i < item.length; i++) {
-          arr.push(item[i]);
-        }
-      });
-      const tableSelectionList = arr;
-      return {
-        classificationList,
-        tableSelectionList,
-        // tableSelectionList: Object.values(this.tableSelectionList)
-        //   .flat()
-        //   .filter(
-        //     // i => !classificationList.find(itm => i.classificationId == itm.id)
-        //      i => !classificationList.find(itm => i.bizTypeId == itm.id)
-        //   )
-        //   .map(item => {
-        //     item.minPackUnit = item.minPackUtil
-        //     return item
-        //   })
-      };
-    },
-    handleAssetsChange() {
-      setTimeout(() => {
-        if (this.assetsName) {
-          let obj = tableContentData.find(
-            (item) => item.name === this.assetsName
-          );
-          this.tableInfoData = (obj && obj.tableData) || [];
-          this._getTreeList();
-          // this.clearSelection()
-        }
-      }, 0);
-    },
-    // 设备、舟皿、周转车、模具
-    async _getTreeList() {
-      let res = await classManagement.getClassificationTreeAsyncCall({
-        id: "0",
-        type: this.assetsType,
-      });
-      if (res?.success) {
-        this.treeList = res.data[0]?.children || [];
-        if (this.isBindPlan) {
-          this.deepEach(this.treeList);
-        }
-        if (this.tableValuableList?.length) {
-          this.$nextTick(() => {
-            this.$refs.treeRef.filter();
-          });
-        }
-
-        if (this.addOrUpdate === "edit") {
-          let keys = [];
-          this.planRuleInventoryDetailList.map((item) => {
-            if (item.bizTypeId !== null) {
-              keys.push(item.bizTypeId);
-            }
-          });
-          keys = [...new Set(keys)];
-          this.defaultExpandedKeys = keys;
-          if (keys.length) {
-            this.$nextTick(() => {
-              this.$refs.treeRef.setCurrentKey(keys[0]);
-              this.convertTreeData();
-              let chooseData = null;
-              this.changeData.map((item) => {
-                if (item.id == keys[0]) {
-                  chooseData = item;
-                }
-              });
-              if (chooseData) {
-                this.getTableInfo(chooseData.id);
-              }
-              //    this.handleNodeClick(chooseData,node)
-            });
-          }
-        }
-      }
-    },
-    handleNodeClick(data, node) {
-      console.log(node, "node");
-      if (!node.isLeaf) return; //限制叶子节点
-      this.curNode = node;
-      // this.getTableInfo(data.id === data.originId ? '' : data.id)
-      this.getTableInfo({
-        assetType: data.type,
-        classificationIds: [data.id],
-      });
-    },
-    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;
-    },
-
-    async getTableInfo(assetSubType) {
-      const params = {
-        page: 1,
-        size: 9999,
-        ...assetSubType,
-      };
-
-      if (assetSubType) {
-        params.assetSubType = assetSubType;
-      }
-      const res = await getgoodspage(params);
-      if (res?.success) {
-        if (this.tableValuableList && this.tableValuableList.length) {
-          // 派单过滤
-          this.tableData = res.data.records
-            .filter(
-              (item) =>
-                this.tableValuableList.findIndex(
-                  (i) => i.assetId == item.id
-                ) !== -1
-            )
-            .map((i, index) => ({
-              ...i,
-              index,
-              classificationId: assetSubType,
-            }));
-        } else {
-          this.tableData = res.data.records.map((i, index) => ({
-            ...i,
-            index,
-            classificationId: assetSubType,
-          }));
-        }
-        const checkedTrees = this.$refs.treeRef.getCheckedKeys();
-
-        // if(this.addOrUpdate === 'edit'){
-        //   this.defaultExpandedKeys
-        // }
-        this.$nextTick(() => {
-          //分类选中
-          this.tableData.map((item) => {
-            if (checkedTrees.includes(item.classificationId + "")) {
-              this.$refs.tableRef.toggleRowSelection(item);
-            }
-          });
-          // 表格选中(切换保存状态
-          for (const key in this.tableSelectionList) {
-            this.tableSelectionList[key].forEach((item) => {
-              const row = this.tableData.find((i) => i.id === item.id);
-              if (row) {
-                //this.$refs.tableRef.toggleRowSelection(row, true)
-              }
-            });
-          }
-        });
-
-        if (this.addOrUpdate === "edit") {
-          if (this.planRuleInventoryDetailList) {
-            this.tableData.map((item) => {
-              for (
-                var i = 0;
-                i < this.planRuleInventoryDetailList.length;
-                i++
-              ) {
-                if (
-                  item.id == this.planRuleInventoryDetailList[i].id
-                ) {
-                  this.$nextTick(() => {
-                    this.$refs.tableRef.toggleRowSelection(item, true);
-                  });
-                }
-              }
-            });
-          }
-        }
-      }
-    },
-
-    // tree选中状态改变
-    clickCheck(data, checkinfo) {
-      const isChecked = checkinfo.checkedKeys.indexOf(data.id) > -1;
-
-      if (!isChecked) {
-        //取消全选
-        this.assetsSelectAll = false;
-      }
-
-      if (this.curNode && this.curNode.data.id === data.id) {
-        this.tableData.forEach((row) => {
-          this.$refs.tableRef.toggleRowSelection(row, isChecked);
-        });
-      }
-    },
-
-    // 资产分类全选  通过点击事件更改状态
-    handleAssetsSelectAll() {
-      if (this.isBindPlan) return;
-      this.assetsSelectAll = !this.assetsSelectAll;
-      if (this.assetsSelectAll) {
-        const keys = this.treeList.map((item) => item.id);
-        this.$refs.treeRef.setCheckedKeys(keys);
-      } else {
-        this.$refs.treeRef.setCheckedKeys([]);
-      }
-    },
-    handleSelectionChange(val) {
-      console.log(val);
-      let bizType = {};
-      if (this.curNode) {
-        bizType = {
-          bizTypeId: this.curNode.data?.id,
-          bizTypeName: this.curNode.data?.name,
-        };
-        this.$set(
-          this.tableSelectionList,
-          this.curNode.data.id,
-          val.map((i) => ({
-            ...i,
-            ...bizType,
-          }))
-        );
-      }
-      if (val.length > 0 && val.length === this.tableData.length) {
-        //全选
-        this.$refs.treeRef.setChecked(val[0].classificationId, true);
-      }
-      if (val.length === 0 && this.tableData.length > 0) {
-        //全不选
-        this.$refs.treeRef.setChecked(
-          this.tableData[0].classificationId,
-          false
-        );
-      }
-    },
-    handleCurSelectionChange(selection, row) {
-      if (selection.findIndex((item) => item.index === row.index) === -1) {
-        //取消选中
-        this.$refs.treeRef.setChecked(row.classificationId, false);
-
-        for (const key in this.tableSelectionList) {
-          const idx = this.tableSelectionList[key].findIndex(
-            (item) => item.id === row.id
-          );
-          if (idx !== -1) {
-            this.tableSelectionList[key].splice(idx, 1);
-          }
-        }
-      }
-    },
-
-    convertTreeData() {
-      this.changeData = this.treeList;
-      for (let i = 0; i < this.changeData.length; i++) {
-        if (this.changeData[i].children != undefined) {
-          const temp = this.changeData[i].children;
-          delete this.changeData[i].children;
-          this.changeData = this.changeData.concat(temp);
-        }
-      }
-    },
-
-    // 子节点处理
-    deepEach(arr) {
-      arr.forEach((item) => {
-        item.disabled = true;
-        if (item.children) {
-          this.deepEach(item.children); // 递归
-        }
-      });
-    },
-  },
-};
-</script>
-
-<style scoped lang="scss">
-::v-deep .table-wrapper .el-table__header-wrapper .el-checkbox {
-  display: none;
-}
-::v-deep.assets-container {
-  display: flex;
-  width: 100%;
-  .el-tree-node__content > .el-checkbox {
-    position: absolute;
-    right: 0;
-  }
-  .tree-wrapper {
-    // width: 350px;
-    width: 30%;
-    margin-right: 12px;
-    border: 1px solid #ccc;
-
-    .title {
-      text-align: center;
-      font-size: 16px;
-      font-weight: bold;
-      background: #f0f3f3;
-      padding: 4px;
-      padding-right: 8px;
-      .el-checkbox {
-        float: right;
-      }
-    }
-    .scroll-wrapper {
-      padding-top: 8px;
-    }
-  }
-  .table-wrapper {
-    width: 70%;
-    padding: 8px;
-    border: 1px solid #ccc;
-  }
-
-  .table-box {
-    width: 70%;
-    padding: 8px;
-    border: 1px solid #ccc;
-  }
-}
-</style>

+ 0 - 86
src/views/rulesManagement/planRules/components/tableContentData.js

@@ -1,86 +0,0 @@
-// 盘点
-export const tableContentData = [
-    {
-        name: '原料',
-        tableData: [
-            { label: '物品编码', key: 'informationCode', inKey: 'informationCode' },
-            { label: '物品名称', key: 'informationName', inKey: 'informationName' },
-            { label: '牌号', key: 'brandNum', inKey: 'brandNum' },
-        ]
-    },
-    {
-        name: '耗材',
-        tableData: [
-            { label: '物品编码', key: 'informationCode', inKey: 'informationCode' },
-            { label: '物品名称', key: 'informationName', inKey: 'informationName' },
-            { label: '规格', key: 'specification', inKey: 'specification' },
-            { label: '型号', key: 'modelType', inKey: 'modelType' }
-        ]
-    },
-    {
-        name: '物料',
-        tableData: [
-            { label: '物品编码', key: 'informationCode', inKey: 'informationCode' },
-            { label: '物品名称', key: 'informationName', inKey: 'informationName' },
-            { label: '规格', key: 'specification', inKey: 'specification' },
-            { label: '型号', key: 'modelType', inKey: 'modelType' },    
-        ]
-    },
-    {
-        name: '产品',
-        tableData: [
-            { label: '物品编码', key: 'informationCode', inKey: 'informationCode' },
-            { label: '物品名称', key: 'informationName', inKey: 'informationName' },
-            { label: '牌号', key: 'brandNum', inKey: 'brandNum' },
-            { label: '型号', key: 'modelType', inKey: 'modelType' }
-        ]
-    },
-    {
-        name: '周转车',
-        tableData: [
-            { label: '物品编码', key: 'informationCode', inKey: 'informationCode' },
-            { label: '物品名称', key: 'informationName', inKey: 'informationName' },
-            { label: '规格', key: 'specification', inKey: 'specification' },
-            { label: '材质', key: 'specification', inKey: 'specification' },
-            { label: '长/宽/高', key: 'ckg', inKey: 'ckg' },
-        ]
-    },
-    {
-        name: '舟皿',
-        tableData: [
-            { label: '物品编码', key: 'informationCode', inKey: 'informationCode' },
-            { label: '物品名称', key: 'informationName', inKey: 'informationName' },
-            { label: '规格', key: 'specification', inKey: 'specification' },
-            { label: '型号', key: 'modelType', inKey: 'modelType' },    
-            { label: '长/宽/高', key: 'ckg', inKey: 'ckg' },
-        ]
-    },
-    {
-        name: '生产设备',
-        tableData: [
-            { label: '物品编码', key: 'informationCode', inKey: 'informationCode' },
-            { label: '物品名称', key: 'informationName', inKey: 'informationName' },
-            { label: '规格', key: 'specification', inKey: 'specification' },
-            { label: '型号', key: 'modelType', inKey: 'modelType' }
-        ]
-    },
-    {
-        name: '模具',
-        tableData: [
-            { label: '物品编码', key: 'informationCode', inKey: 'informationCode' },
-            { label: '物品名称', key: 'informationName', inKey: 'informationName' },
-            { label: '规格', key: 'specification', inKey: 'specification' },
-            { label: '型号', key: 'modelType', inKey: 'modelType' },
-            { label: '收缩系数', key: 'shrinkageCoefficient', inKey: 'shrinkageCoefficient' }
-        ]
-    },
-    {
-        name: '备品备件',
-        tableData: [
-            { label: '物品编码', key: 'informationCode', inKey: 'informationCode' },
-            { label: '物品名称', key: 'informationName', inKey: 'informationName' },
-            { label: '规格', key: 'specification', inKey: 'specification' },
-            { label: '型号', key: 'modelType', inKey: 'modelType' },    
-        ]
-    }
-]

+ 10 - 224
src/views/rulesManagement/planRules/index.vue

@@ -25,213 +25,40 @@
         <div v-if="activeComp == 'anmac'">
           <Maintenance />
         </div>
-        <div v-if="activeComp == 'plan'" class="plan">
-          <inventory-search ref="inventorySearch" @search="reload">
-          </inventory-search>
-          <!-- 数据表格 -->
-          <ele-pro-table
-            ref="table"
-            :columns="columns"
-            :datasource="datasource"
-            cache-key="systemRoleTable14"
-          >
-            <!-- 表头工具栏 -->
-            <template v-slot:toolbar="{ row }">
-              <el-button
-                size="small"
-                type="primary"
-                icon="el-icon-plus"
-                class="ele-btn-icon"
-                @click="openEdit()"
-              >
-                新建
-              </el-button>
-            </template>
-            <!-- 操作列 -->
-            <template v-slot:action="{ row }">
-              <el-link
-                type="primary"
-                :underline="false"
-                icon="el-icon-edit"
-                @click="openEdit(row)"
-              >
-                修改
-              </el-link>
-              <el-link
-                type="primary"
-                class="ele-btn-icon"
-                @click="goDetail(row)"
-              >
-                详情
-              </el-link>
-              <el-popconfirm
-                class="ele-action"
-                title="确定要删除此角色吗?"
-                @confirm="remove(row)"
-              >
-                <template v-slot:reference>
-                  <el-link
-                    type="danger"
-                    :underline="false"
-                    icon="el-icon-delete"
-                  >
-                    删除
-                  </el-link>
-                </template>
-              </el-popconfirm>
-            </template>
-          </ele-pro-table>
+        <div v-if="activeComp == 'warehouseInventory'">
+          <WarehouseInventory />
         </div>
         <div v-if="activeComp == 'measuringSubmit'">
           <MeasuringSubmit />
         </div>
       </div>
     </el-card>
-
-    <!-- 新建或编辑弹窗 -->
-    <AddInventoryDialog
-      ref="addInventoryDialogRef"
-      :dialogTile="dialogTitle"
-      :id="inventoryId"
-      @refreshList="resetForm"
-      :isBindPlan="isBindPlan"
-    />
   </div>
 </template>
 
 <script>
-  import { deleteStocktakingPlan } from '@/api/ruleManagement/plan';
-  import { getInventoryList } from '@/api/ruleManagement/plan';
   import InspectionPoint from '../inspectionPoint';
   import MeasuringSubmit from '../measuringSubmit';
   import Maintenance from '../maintenance';
-  import InventorySearch from './components/inventory-search.vue';
-  import AddInventoryDialog from './components/addInventoryDialog.vue';
-  import { pageRoles } from '@/api/system/role';
+  import WarehouseInventory from '../warehouseInventory';
   export default {
     components: {
-      InventorySearch,
-      AddInventoryDialog,
       InspectionPoint,
       MeasuringSubmit,
-      Maintenance
+      Maintenance,
+      WarehouseInventory
     },
     data() {
       return {
-        inventoryId: '',
         activeComp: 'point',
         tabOptions: [
           { key: 'point', name: '巡点检配置' },
           { key: 'anmac', name: '保养配置' },
-          { key: 'plan', name: '盘点配置' },
+          { key: 'warehouseInventory', name: '仓库盘点配置' },
           { key: 'measuringSubmit', name: '量具送检配置' }
         ],
-        // 表格列配置
-        columns: [
-          {
-            columnKey: 'index',
-            label: '序号',
-            type: 'index',
-            width: 55,
-            align: 'center',
-            showOverflowTooltip: true,
-            fixed: 'left'
-          },
-          {
-            prop: 'planCode',
-            label: '计划单号',
-            align: 'center',
-            showOverflowTooltip: true,
-            minWidth: 110
-          },
-          {
-            prop: 'planName',
-            label: '盘点名称',
-            align: 'center',
-            showOverflowTooltip: true,
-            minWidth: 110
-          },
-          {
-            prop: 'warehouseName',
-            label: '盘点仓库',
-            align: 'center',
-            showOverflowTooltip: true,
-            slot: 'enable',
-            minWidth: 110
-          },
-          {
-            prop: 'executeGroupName',
-            label: '盘点部门',
-            align: 'center',
-            showOverflowTooltip: true,
-            minWidth: 110
-          },
-          {
-            prop: 'categoryLevelName',
-            label: '资产分类',
-            align: 'center',
-            showOverflowTooltip: true,
-            minWidth: 110
-          },
-          {
-            prop: 'ruleName',
-            label: '规则名称',
-            align: 'center',
-            showOverflowTooltip: true,
-            minWidth: 110
-          },
-          {
-            prop: 'autoOrder',
-            label: '自动派单',
-            align: 'center',
-            showOverflowTooltip: true,
-            minWidth: 110,
-            formatter: (row) => {
-              return { 0: '否', 1: '是' }[row.autoOrder];
-            }
-          },
-          {
-            prop: 'enable',
-            label: '状态',
-            align: 'center',
-            showOverflowTooltip: true,
-            minWidth: 110,
-            formatter: (row) => {
-              return { 0: '失效', 1: '生效' }[row.enable];
-            }
-          },
-          {
-            prop: 'createUserName',
-            label: '创建人',
-            align: 'center',
-            showOverflowTooltip: true,
-            minWidth: 110
-          },
-          {
-            prop: 'createTime',
-            label: '创建时间',
-            align: 'center',
-            showOverflowTooltip: true,
-            minWidth: 110,
-            formatter: (_row, _column, cellValue) => {
-              return this.$util.toDateString(cellValue);
-            }
-          },
-          {
-            columnKey: 'action',
-            label: '操作',
-            width: 200,
-            align: 'center',
-            resizable: false,
-            slot: 'action',
-            showOverflowTooltip: true
-          }
-        ],
         // 加载状态
-        loading: false,
-        pageType: 'add',
-        dialogTitle: '',
-        isBindPlan: false
+        loading: false
       };
     },
     mounted() {
@@ -246,53 +73,12 @@
         case '量具送检':
           this.activeComp = 'measuringSubmit';
           break;
+        case '仓库盘点配置':
+          this.activeComp = 'warehouseInventory';
+          break;
         default:
           break;
       }
-    },
-    methods: {
-      // 重置
-      resetForm() {
-        this.$refs.inventorySearch.reset();
-        // this.$refs.configFormRef.resetFields();
-        // this.searchForm()
-      },
-      /* 表格数据源 */
-      datasource({ page, limit, where, order }) {
-        return getInventoryList({ pageNum: page, size: limit, ...where });
-      },
-      /* 刷新表格 */
-      reload(where) {
-        this.$refs.table.reload({ page: 1, where });
-      },
-      remove(row) {
-        deleteStocktakingPlan([row.id]).then((res) => {
-          console.log(res);
-          if (res.code == 0) {
-            this.$message.success('删除成功');
-            this.$refs.inventorySearch.reset();
-          }
-        });
-      },
-
-      openEdit(row) {
-        if (row) {
-          this.dialogTitle = '修改盘点计划配置';
-          this.inventoryId = row.id;
-        } else {
-          this.dialogTitle = '新增盘点计划配置';
-          this.inventoryId = '';
-        }
-        this.isBindPlan = false;
-        this.$refs.addInventoryDialogRef.dialogVisible = true;
-        // this.$store.dispatch('planRules/setAddOrUpdate', 'add')
-      },
-      goDetail(row) {
-        this.dialogTitle = '盘点计划配置详情';
-        this.inventoryId = row.id;
-        this.isBindPlan = true;
-        this.$refs.addInventoryDialogRef.dialogVisible = true;
-      }
     }
   };
 </script>

+ 512 - 0
src/views/rulesManagement/warehouseInventory/components/AssetsInWarehouse.vue

@@ -0,0 +1,512 @@
+<template>
+  <div class="assets-container" v-show="assetsName">
+    <div class="tree-wrapper">
+      <div class="title">
+        {{ assetsName }}
+        <el-checkbox
+          :value="assetsSelectAll"
+          @click.native.prevent="handleAssetsSelectAll"
+          :disabled="isBindPlan"
+        ></el-checkbox>
+      </div>
+      <div class="scroll-wrapper">
+        <el-tree
+          show-checkbox
+          :data="treeList"
+          :props="{
+            children: 'children',
+            value: 'code',
+            label: 'name'
+          }"
+          :filter-node-method="filterNode"
+          v-loading="treeLoading"
+          node-key="id"
+          ref="treeRef"
+          :default-expanded-keys="defaultExpandedKeys"
+          :highlight-current="true"
+          @node-click="handleNodeClick"
+          @check="clickCheck"
+        >
+          <span class="custom-tree-node" slot-scope="{ node, data }">
+            <span>{{ node.label }}</span>
+          </span>
+        </el-tree>
+      </div>
+    </div>
+    <div :class="isBindPlan ? 'table-wrapper' : 'table-box'">
+      <el-table
+        style="width: 100% !important"
+        height="400px"
+        ref="tableRef"
+        :data="tableData"
+        @selection-change="handleSelectionChange"
+        @select="handleCurSelectionChange"
+        :key="assetsName"
+        :header-cell-style="{
+          background: '#F0F3F3',
+          border: 'none'
+        }"
+        :disabled="isBindPlan"
+      >
+        <el-table-column
+          v-for="item in tableInfoData"
+          :key="item.key"
+          :prop="item.inKey"
+          :label="item.label"
+          :width="item.width"
+        >
+        </el-table-column>
+        <el-table-column
+          type="selection"
+          :selectable="selectable"
+          :width="tableData.length ? '55' : '500'"
+        >
+        </el-table-column>
+      </el-table>
+    </div>
+  </div>
+</template>
+
+<script>
+  import { mapGetters } from 'vuex';
+  import { tableContentData } from './tableContentData.js';
+  export default {
+    props: {
+      assetsName: {
+        type: String,
+        default: ''
+      },
+      warehouseId: {
+        type: [Number, String],
+        default: ''
+      },
+      tableValuableList: {
+        type: Array,
+        default: () => []
+      },
+      assetsType: {
+        type: [String, Number],
+        default: ''
+      },
+      assetSubType: {
+        type: [String, Number],
+        default: ''
+      },
+      planRuleInventoryDetailList: {
+        type: Array,
+        default: []
+      },
+      isBindPlan: {
+        type: Boolean,
+        default: function () {
+          return false;
+        }
+      }
+    },
+    computed: {
+      ...mapGetters(['addOrUpdate'])
+    },
+    watch: {
+      // warehouseId() {
+      //   if (this.curNode) {
+      //     this.getTableInfo(
+      //       this.curNode.data.id === this.curNode.data.originId
+      //         ? ""
+      //         : this.curNode.data.id
+      //     );
+      //   }
+      // },
+      planRuleInventoryDetailList(val) {
+        console.log('asd', val);
+        if (val) {
+          this.$nextTick(() => {
+            val.forEach((item) => {
+              if (!this.tableSelectionList[item.bizTypeId]) {
+                this.tableSelectionList[item.bizTypeId] = [item];
+              } else {
+                this.tableSelectionList[item.bizTypeId].push(item);
+              }
+            });
+            this.handleAssetsChange();
+          });
+        }
+      }
+    },
+    data() {
+      return {
+        treeList: [],
+        tableInfoData: [],
+        tableData: [],
+        requestApi: '',
+        treeLoading: false,
+        tableSelectionList: {},
+        assetsSelectionList: [],
+        assetsSelectAll: false,
+        curNode: null,
+        defaultExpandedKeys: [],
+        changeData: [],
+        isChecked: false
+      };
+    },
+    mounted() {
+      this.$nextTick(() => {
+        this.handleAssetsChange();
+      });
+    },
+    created() {
+      // console.log('库内')
+      // if(this.planRuleInventoryDetailList){
+      //   console.log('this.planRuleInventoryDetailList',this.planRuleInventoryDetailList)
+      //   this.tableData = this.planRuleInventoryDetailList
+      // }
+    },
+    methods: {
+      //表格复选框禁用
+      selectable(row, rowIndex) {
+        if (this.isBindPlan) {
+          return false;
+        } else {
+          return true;
+        }
+      },
+      // 重置
+      resetData() {
+        this.clearSelection();
+        this.treeList = [];
+      },
+      //清除选中
+      clearSelection() {
+        this.assetsSelectAll = false;
+        this.tableData = [];
+        this.tableSelectionList = {};
+      },
+      //派单过滤
+      filterNode(value, data, node) {
+        return (
+          this.tableValuableList.findIndex(
+            (item) => item.bizTypeId === data.id
+          ) !== -1
+        );
+      },
+      getSelectList() {
+        const classificationList =
+          (this.$refs.treeRef && this.$refs.treeRef.getCheckedNodes()) || [];
+        const list = Object.values(this.tableSelectionList) || [];
+        var arr = [];
+        list.map((item, index) => {
+          for (var i = 0; i < item.length; i++) {
+            arr.push(item[i]);
+          }
+        });
+        const tableSelectionList = arr;
+        return {
+          classificationList,
+          tableSelectionList
+          // tableSelectionList: Object.values(this.tableSelectionList)
+          //   .flat()
+          //   .filter(
+          //     // i => !classificationList.find(itm => i.classificationId == itm.id)
+          //      i => !classificationList.find(itm => i.bizTypeId == itm.id)
+          //   )
+          //   .map(item => {
+          //     item.minPackUnit = item.minPackUtil
+          //     return item
+          //   })
+        };
+      },
+      handleAssetsChange() {
+        setTimeout(() => {
+          if (this.assetsName) {
+            let obj = tableContentData.find(
+              (item) => item.name === this.assetsName
+            );
+            this.tableInfoData = (obj && obj.tableData) || [];
+            this._getTreeList();
+            // this.clearSelection()
+          }
+        }, 0);
+      },
+      // 设备、舟皿、周转车、模具
+      async _getTreeList() {
+        let res = await classManagement.getClassificationTreeAsyncCall({
+          id: '0',
+          type: this.assetsType
+        });
+        if (res?.success) {
+          this.treeList = res.data[0]?.children || [];
+          if (this.isBindPlan) {
+            this.deepEach(this.treeList);
+          }
+          if (this.tableValuableList?.length) {
+            this.$nextTick(() => {
+              this.$refs.treeRef.filter();
+            });
+          }
+
+          if (this.addOrUpdate === 'edit') {
+            let keys = [];
+            this.planRuleInventoryDetailList.map((item) => {
+              if (item.bizTypeId !== null) {
+                keys.push(item.bizTypeId);
+              }
+            });
+            keys = [...new Set(keys)];
+            this.defaultExpandedKeys = keys;
+            if (keys.length) {
+              this.$nextTick(() => {
+                this.$refs.treeRef.setCurrentKey(keys[0]);
+                this.convertTreeData();
+                let chooseData = null;
+                this.changeData.map((item) => {
+                  if (item.id == keys[0]) {
+                    chooseData = item;
+                  }
+                });
+                if (chooseData) {
+                  this.getTableInfo(chooseData.id);
+                }
+                //    this.handleNodeClick(chooseData,node)
+              });
+            }
+          }
+        }
+      },
+      handleNodeClick(data, node) {
+        console.log(node, 'node');
+        if (!node.isLeaf) return; //限制叶子节点
+        this.curNode = node;
+        // this.getTableInfo(data.id === data.originId ? '' : data.id)
+        this.getTableInfo({
+          assetType: data.type,
+          classificationIds: [data.id]
+        });
+      },
+      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;
+      },
+
+      async getTableInfo(assetSubType) {
+        const params = {
+          page: 1,
+          size: 9999,
+          ...assetSubType
+        };
+
+        if (assetSubType) {
+          params.assetSubType = assetSubType;
+        }
+        const res = await getgoodspage(params);
+        if (res?.success) {
+          if (this.tableValuableList && this.tableValuableList.length) {
+            // 派单过滤
+            this.tableData = res.data.records
+              .filter(
+                (item) =>
+                  this.tableValuableList.findIndex(
+                    (i) => i.assetId == item.id
+                  ) !== -1
+              )
+              .map((i, index) => ({
+                ...i,
+                index,
+                classificationId: assetSubType
+              }));
+          } else {
+            this.tableData = res.data.records.map((i, index) => ({
+              ...i,
+              index,
+              classificationId: assetSubType
+            }));
+          }
+          const checkedTrees = this.$refs.treeRef.getCheckedKeys();
+
+          // if(this.addOrUpdate === 'edit'){
+          //   this.defaultExpandedKeys
+          // }
+          this.$nextTick(() => {
+            //分类选中
+            this.tableData.map((item) => {
+              if (checkedTrees.includes(item.classificationId + '')) {
+                this.$refs.tableRef.toggleRowSelection(item);
+              }
+            });
+            // 表格选中(切换保存状态
+            for (const key in this.tableSelectionList) {
+              this.tableSelectionList[key].forEach((item) => {
+                const row = this.tableData.find((i) => i.id === item.id);
+                if (row) {
+                  //this.$refs.tableRef.toggleRowSelection(row, true)
+                }
+              });
+            }
+          });
+
+          if (this.addOrUpdate === 'edit') {
+            if (this.planRuleInventoryDetailList) {
+              this.tableData.map((item) => {
+                for (
+                  var i = 0;
+                  i < this.planRuleInventoryDetailList.length;
+                  i++
+                ) {
+                  if (item.id == this.planRuleInventoryDetailList[i].id) {
+                    this.$nextTick(() => {
+                      this.$refs.tableRef.toggleRowSelection(item, true);
+                    });
+                  }
+                }
+              });
+            }
+          }
+        }
+      },
+
+      // tree选中状态改变
+      clickCheck(data, checkinfo) {
+        const isChecked = checkinfo.checkedKeys.indexOf(data.id) > -1;
+
+        if (!isChecked) {
+          //取消全选
+          this.assetsSelectAll = false;
+        }
+
+        if (this.curNode && this.curNode.data.id === data.id) {
+          this.tableData.forEach((row) => {
+            this.$refs.tableRef.toggleRowSelection(row, isChecked);
+          });
+        }
+      },
+
+      // 资产分类全选  通过点击事件更改状态
+      handleAssetsSelectAll() {
+        if (this.isBindPlan) return;
+        this.assetsSelectAll = !this.assetsSelectAll;
+        if (this.assetsSelectAll) {
+          const keys = this.treeList.map((item) => item.id);
+          this.$refs.treeRef.setCheckedKeys(keys);
+        } else {
+          this.$refs.treeRef.setCheckedKeys([]);
+        }
+      },
+      handleSelectionChange(val) {
+        console.log(val);
+        let bizType = {};
+        if (this.curNode) {
+          bizType = {
+            bizTypeId: this.curNode.data?.id,
+            bizTypeName: this.curNode.data?.name
+          };
+          this.$set(
+            this.tableSelectionList,
+            this.curNode.data.id,
+            val.map((i) => ({
+              ...i,
+              ...bizType
+            }))
+          );
+        }
+        if (val.length > 0 && val.length === this.tableData.length) {
+          //全选
+          this.$refs.treeRef.setChecked(val[0].classificationId, true);
+        }
+        if (val.length === 0 && this.tableData.length > 0) {
+          //全不选
+          this.$refs.treeRef.setChecked(
+            this.tableData[0].classificationId,
+            false
+          );
+        }
+      },
+      handleCurSelectionChange(selection, row) {
+        if (selection.findIndex((item) => item.index === row.index) === -1) {
+          //取消选中
+          this.$refs.treeRef.setChecked(row.classificationId, false);
+
+          for (const key in this.tableSelectionList) {
+            const idx = this.tableSelectionList[key].findIndex(
+              (item) => item.id === row.id
+            );
+            if (idx !== -1) {
+              this.tableSelectionList[key].splice(idx, 1);
+            }
+          }
+        }
+      },
+
+      convertTreeData() {
+        this.changeData = this.treeList;
+        for (let i = 0; i < this.changeData.length; i++) {
+          if (this.changeData[i].children != undefined) {
+            const temp = this.changeData[i].children;
+            delete this.changeData[i].children;
+            this.changeData = this.changeData.concat(temp);
+          }
+        }
+      },
+
+      // 子节点处理
+      deepEach(arr) {
+        arr.forEach((item) => {
+          item.disabled = true;
+          if (item.children) {
+            this.deepEach(item.children); // 递归
+          }
+        });
+      }
+    }
+  };
+</script>
+
+<style scoped lang="scss">
+  ::v-deep .table-wrapper .el-table__header-wrapper .el-checkbox {
+    display: none;
+  }
+  ::v-deep.assets-container {
+    display: flex;
+    width: 100%;
+    .el-tree-node__content > .el-checkbox {
+      position: absolute;
+      right: 0;
+    }
+    .tree-wrapper {
+      // width: 350px;
+      width: 30%;
+      margin-right: 12px;
+      border: 1px solid #ccc;
+
+      .title {
+        text-align: center;
+        font-size: 16px;
+        font-weight: bold;
+        background: #f0f3f3;
+        padding: 4px;
+        padding-right: 8px;
+        .el-checkbox {
+          float: right;
+        }
+      }
+      .scroll-wrapper {
+        padding-top: 8px;
+      }
+    }
+    .table-wrapper {
+      width: 70%;
+      padding: 8px;
+      border: 1px solid #ccc;
+    }
+
+    .table-box {
+      width: 70%;
+      padding: 8px;
+      border: 1px solid #ccc;
+    }
+  }
+</style>

+ 1067 - 0
src/views/rulesManagement/warehouseInventory/components/addInventoryDialog copy.vue

@@ -0,0 +1,1067 @@
+<template>
+  <el-dialog
+    :visible.sync="dialogVisible"
+    :title="dialogTile"
+    :before-close="handleClose"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    v-loading="addDialogLoading"
+    width="80%"
+  >
+    <el-form
+      :model="addForm"
+      class="add_form"
+      ref="addFormRef"
+      :rules="rules"
+      label-width="110px"
+    >
+      <el-row :gutter="20">
+        <el-col :span="8">
+          <el-form-item label="计划配置单号" prop="code">
+            <el-input
+              v-model="addForm.planCode"
+              placeholder="自动生成"
+              disabled
+            ></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="计划配置名称" prop="planName">
+            <el-input
+              v-model="addForm.planName"
+              placeholder="请输入"
+              :disabled="isBindPlan"
+            ></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="自动派单" prop="autoOrder">
+            <el-select
+              v-model="addForm.autoOrder"
+              class="w100"
+              placeholder="请选择"
+              :disabled="isBindPlan"
+              filterable
+            >
+              <el-option :value="1" label="是"></el-option>
+              <el-option :value="0" label="否"></el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="规则名称" prop="ruleId">
+            <el-select
+              v-model="addForm.ruleId"
+              class="w100"
+              placeholder="请选择规则名称"
+              @change="change_ruleId"
+              :disabled="isBindPlan"
+              filterable
+            >
+              <el-option
+                v-for="item in ruleNameList"
+                :key="item.id"
+                :value="item.id"
+                :label="item.name"
+                @click.native="addForm.ruleName = item.name"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="计划盘点时长" prop="duration">
+            <el-input
+              v-model.number="addForm.duration"
+              placeholder="请输入"
+              :disabled="isBindPlan"
+            >
+              <template #suffix>分钟</template>
+            </el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="盘点类型" prop="inventoryType">
+            <el-select
+              v-model="addForm.inventoryType"
+              class="w100"
+              placeholder="请选择"
+              @change="chooseType"
+              disabled
+              filterable
+            >
+              <el-option
+                v-for="item in inventoryTypeStatus"
+                :key="item.code"
+                :value="item.code"
+                :label="item.label"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col v-if="addForm.inventoryType == 1" :span="8">
+          <el-form-item label="盘点仓库" prop="warehouseId">
+            <el-select
+              placeholder="请选择"
+              class="w100"
+              :disabled="isBindPlan"
+              v-model="addForm.warehouseId"
+              @change="changeWarehouse"
+              filterable
+            >
+              <el-option
+                v-for="item in warehouseList"
+                :key="item.id"
+                :value="item.id"
+                :label="item.name"
+                @click.native="
+                  () => {
+                    addForm.bizTypeName = item.name;
+                  }
+                "
+              ></el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <!-- <el-col :span="8">
+          <el-form-item label="审核人" prop="verifyUserId">
+            <el-select
+              v-model="addForm.verifyUserId"
+              size="small"
+              style="width: 100%"
+              :disabled="isBindPlan"
+              filterable
+            >
+              <el-option
+                v-for="item in uerList"
+                :key="item.id"
+                :value="item.id"
+                :label="item.name"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+        </el-col> -->
+
+        <el-col :span="8">
+          <el-form-item
+            :label="type == 2 ? '产品分类' : '资产分类'"
+            prop="categoryLevelId"
+          >
+            <ele-tree-select
+              multiple
+              clearable
+              :disabled="isBindPlan"
+              :data="codeList"
+              @change="codeListValue"
+              v-model="addForm.categoryLevelId"
+              valueKey="id"
+              labelKey="name"
+              :show-checkbox="true"
+              :check-strictly="true"
+              filterable
+              placeholder="请选择"
+            />
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="紧急程度" prop="urgent">
+            <DictSelection
+              :isProhibit="isBindPlan"
+              dictName="紧急程度"
+              clearable
+              filterable
+              v-model="addForm.urgent"
+            >
+            </DictSelection>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8" v-if="addForm.autoOrder">
+          <el-form-item label="执行部门" prop="executeGroupId">
+            <deptSelect
+              :isBindPlan="isBindPlan"
+              v-model="addForm.executeGroupId"
+              @changeGroup="searchDeptNodeClick"
+            />
+          </el-form-item>
+        </el-col>
+        <el-col :span="8" v-if="addForm.autoOrder">
+          <el-form-item label="执行人员" prop="executorId">
+            <el-select
+              v-model="addForm.executorId"
+              @change="changeExecutor"
+              :disabled="isBindPlan"
+              size="small"
+              style="width: 100%"
+              filterable
+            >
+              <el-option
+                v-for="item in executorList"
+                :key="item.id"
+                :value="item.id"
+                :label="item.name"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col v-if="addForm.inventoryType == 1" :span="8">
+          <el-form-item label="锁库盘点" prop="isTreasuryLock">
+            <el-switch
+              v-model="addForm.lockWarehouse"
+              active-text="开"
+              inactive-text="关"
+              :active-value="1"
+              :inactive-value="0"
+              :disabled="isBindPlan"
+            ></el-switch>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="状态" prop="enable">
+            <el-switch
+              v-model="addForm.enable"
+              :disabled="isBindPlan"
+              active-text="开"
+              inactive-text="关"
+              :active-value="1"
+              :inactive-value="0"
+            ></el-switch>
+          </el-form-item>
+        </el-col>
+        <el-col :span="24">
+          <el-form-item label="备注" prop="remark">
+            <el-input
+              placeholder="请输入"
+              type="textarea"
+              :rows="2"
+              resize="none"
+              v-model="addForm.remark"
+              :disabled="isBindPlan"
+            ></el-input>
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <div class="table_search">
+        <el-select
+          style="margin-right: 10px"
+          :disabled="isBindPlan"
+          @change="dimensionChange"
+          v-model="dimension"
+          placeholder="请选择维度"
+        >
+          <el-option label="物品维度" :value="1"> </el-option>
+          <el-option label="批次维度" :value="2"> </el-option>
+        </el-select>
+        <el-input
+          v-if="!isBindPlan"
+          style="width: 400px"
+          placeholder="请输入名称/编码/批次号/型号/规格"
+          v-model="keyWord"
+          class="input-with-select"
+        >
+          <el-button
+            slot="append"
+            icon="el-icon-search"
+            type="primary"
+            @click="getProductList"
+            >搜索</el-button
+          >
+        </el-input>
+      </div>
+      <el-table
+        ref="table"
+        :data="productList"
+        row-key="id"
+        @selection-change="selecctedRow"
+        tooltip-effect="dark"
+        border
+      >
+        <el-table-column
+          v-if="!isBindPlan"
+          align="center"
+          width="50"
+          :reserve-selection="true"
+          :selectable="checkSelectable"
+          type="selection"
+        ></el-table-column>
+        <el-table-column label="序号" type="index" width="50">
+        </el-table-column>
+        <el-table-column
+          label="物品编码"
+          prop="categoryCode"
+          :show-overflow-tooltip="true"
+        ></el-table-column>
+        <el-table-column
+          label="物品名称"
+          prop="categoryName"
+          :show-overflow-tooltip="true"
+        ></el-table-column>
+        <el-table-column
+          label="批次号"
+          prop="batchNo"
+          :show-overflow-tooltip="true"
+        ></el-table-column>
+        <el-table-column
+          label="牌号"
+          prop="brandNum"
+          :show-overflow-tooltip="true"
+        ></el-table-column>
+        <el-table-column
+          label="型号"
+          prop="categoryModel"
+          :show-overflow-tooltip="true"
+        ></el-table-column>
+        <el-table-column
+          label="规格"
+          prop="specification"
+          :show-overflow-tooltip="true"
+        ></el-table-column>
+        <el-table-column
+          label="计量数量"
+          prop="measureQuantity"
+          :show-overflow-tooltip="true"
+        ></el-table-column>
+        <el-table-column
+          label="计量单位"
+          prop="measureUnit"
+          :show-overflow-tooltip="true"
+        ></el-table-column>
+        <el-table-column
+          label="重量"
+          prop="weight"
+          :show-overflow-tooltip="true"
+        >
+        </el-table-column>
+        <el-table-column
+          label="重量单位"
+          prop="weightUnit"
+          :show-overflow-tooltip="true"
+        >
+        </el-table-column>
+      </el-table>
+      <el-pagination
+        v-if="!isBindPlan"
+        background
+        layout="total, sizes, prev, pager, next, jumper"
+        :total="total"
+        :page-sizes="[10, 20, 50, 100]"
+        :page-size.sync="size"
+        :current-page.sync="page"
+        @current-change="getProductList"
+        @size-change="getProductList"
+      >
+      </el-pagination>
+      <!-- 库外 -->
+      <!-- <Assets
+        ref="assetsRef"
+        :assetsName="addForm.assetsName"
+        :assetsType="assetsType"
+        :planRuleInventoryDetailList="planRuleInventoryDetailList"
+        :isBindPlan = "isBindPlan"
+        v-if="
+          addForm.bizType === 2 &&
+          addForm.assetsName != '物料' &&
+          addForm.assetsName != '产品' &&
+          addForm.assetsName != '备品备件'
+        "
+      /> -->
+      <!-- 库内 库存台账 -->
+      <AssetsInWarehouse
+        ref="assetsRef"
+        :assetsName="addForm.assetsName"
+        :warehouseId="addForm.bizTypeId"
+        :assetsType="assetsType"
+        :bizType="addForm.inventoryType"
+        :planRuleInventoryDetailList="planRuleInventoryDetailList"
+        :isBindPlan="isBindPlan"
+      />
+    </el-form>
+    <div v-if="!isBindPlan" slot="footer">
+      <el-button type="primary" size="small" @click="submit">提交</el-button>
+      <el-button size="small" @click="handleClose">关闭</el-button>
+    </div>
+    <div v-else slot="footer">
+      <el-button type="primary" size="small" @click="dialogVisible = false"
+        >确定</el-button
+      >
+      <el-button size="small" @click="dialogVisible = false">关闭</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+  import { getFactoryarea } from '@/api/factoryModel';
+  import { listWorkshopByParentId, listFactoryLine } from '@/api/factoryModel';
+  import { listByProductionLineId } from '@/api/workforceManagement/team';
+  import selectTree from '@/components/selectTree/index_other.vue';
+  import { getTreeByGroup } from '@/api/classifyManage';
+  import { inventoryTypeStatus } from '@/utils/dict/rulesManagement';
+  import { mapGetters } from 'vuex';
+  // import { wh_checkStatus} from '@/utils/dict/warehouse'
+  import { getCode } from '@/api/ruleManagement/matter';
+  import AssetsInWarehouse from './AssetsInWarehouse';
+  import { fieldModel } from '@/api/codeManagement';
+  import {
+    getRule,
+    getProductList,
+    getBatchList,
+    getWarehouseList,
+    saveStocktakingPlan,
+    updateStocktakingPlan,
+    getInventoryDetailById
+  } from '@/api/ruleManagement/plan';
+  import { getUserPage } from '@/api/system/organization';
+  import deptSelect from '@/components/CommomSelect/dept-select.vue';
+  export default {
+    props: {
+      dialogTile: {
+        type: String,
+        default: '新增盘点计划配置'
+      },
+      isBindPlan: {
+        type: Boolean,
+        default: function () {
+          return false;
+        }
+      },
+      id: {
+        type: String,
+        default: ''
+      }
+    },
+    components: {
+      deptSelect,
+      AssetsInWarehouse,
+      selectTree
+    },
+    data() {
+      return {
+        type: 2, // 盘点类型 2仓储 4资产
+        dimension: 1, // 盘点维度1物品 2批次
+        factoryOptions: [],
+        workshopOptions: [],
+        productionLineOptions: [],
+        stationOptions: [],
+        codeList: [],
+        inventoryTypeStatus,
+        addDialogLoading: false,
+        dialogVisible: false,
+        wh_checkStatus: [], // 盘点类型
+        warehouseList: [], // 盘点仓库
+        uerList: [], // 审核人
+        executorList: [], // 执行人
+        assetsType: null,
+        planRuleInventoryDetailList: [],
+        tableList: [],
+        newColumns: [],
+        selection: [],
+        keyWord: '',
+        total: 0,
+        page: 1,
+        size: 10,
+        productList: [],
+        addForm: {
+          code: '', // 计划配置单号
+          planName: '', // 计划配置名称
+          categoryId: 0, // 类别ID
+          autoOrder: 1, // 是否自动派单
+          ruleId: '', // 规则名称
+          categoryLevelId: [], // 物品Ids
+          inventoryType: 1, // 盘点类型
+          bizTypeId: '', // 盘点仓库Id
+          bizTypeName: '', // 盘点仓库name
+          verifyUserId: '', // 审核人Id
+          verifyUserName: '', // 审核人name
+          duration: null, // 盘点时长
+          assetDict: '', // 资产分类id
+          assetsName: '', // 资产分类name
+          urgent: '1', // 紧急程度
+          executeGroupId: '', // 执行部门code
+          executeGroupName: '', // 执行部门name
+          executorId: '', // 执行人id
+          executorName: '', // 执行人name
+          isTreasuryLock: false, // 是否锁库盘点
+          enable: 1, // 状态
+          remark: '', // 备注
+          productionLineId: '',
+          productionLineName: '',
+          workshopId: '',
+          workshopName: '',
+          plantId: '',
+          plantName: '',
+          stationId: '',
+          stationName: ''
+        },
+        rules: {
+          planName: [
+            { required: true, message: '请输入计划配置名称', trigger: 'blur' }
+          ],
+          autoOrder: [
+            { required: true, message: '请选择是否自动派单', trigger: 'change' }
+          ],
+          ruleId: [
+            { required: true, message: '请选择规则名称', trigger: 'change' }
+          ],
+          duration: [
+            { required: true, message: '请输入计划完成时长', trigger: 'blur' }
+          ],
+          inventoryType: [
+            { required: true, message: '请选择盘点类型', trigger: 'change' }
+          ],
+          // plantId: [
+          //   {
+          //     required: true,
+          //     message: '请选择厂房',
+          //     trigger: 'change'
+          //   }
+          // ],
+          warehouseId: [
+            { required: true, message: '请选择盘点仓库', trigger: 'change' }
+          ],
+          verifyUserId: [
+            { required: false, message: '请选择审核人', trigger: 'change' }
+          ],
+          executeGroupId: [
+            { required: true, message: '请选择选择执行部门', trigger: 'change' }
+          ],
+          executorId: [
+            { required: true, message: '请选择选择执行人员', trigger: 'change' }
+          ],
+          assetDict: [
+            { required: true, message: '请选择资产分类', trigger: 'change' }
+          ]
+        },
+        ruleNameList: []
+      };
+    },
+    watch: {
+      dialogVisible(val) {
+        if (val) {
+          // // 获取审核人列表数据
+          // this.getUserList();
+          // 获取盘点仓库
+          this._getWarehouse();
+          // 获取计划单号
+          this.getOrderCode();
+          // 获取规则名称
+          this._getRuleNameList();
+          // 获取物品类型
+          this.getGoodsList();
+          // 获取工厂列表
+          this.getFactoryareaList();
+          if (
+            this.dialogTile === '修改盘点计划配置' ||
+            this.dialogTile === '盘点计划配置详情'
+          ) {
+            getInventoryDetailById(this.id).then(async (res) => {
+              console.log(res);
+              res.warehouseId = res.warehouseId > 0 ? res.warehouseId : '';
+              res.urgent = String(res.urgent);
+              res.categoryLevelId = res.categoryLevelId
+                ? res.categoryLevelId.split(',')
+                : [];
+              this.addForm = res;
+              this.dimension = res.planConfigDetailVOList[0].batch_no ? 2 : 1;
+              if (this.addForm.executeGroupId) {
+                this.getUserList({ groupId: this.addForm.executeGroupId });
+              }
+              if (this.dialogTile === '修改盘点计划配置') {
+                // 回显物品列表
+                let categoryIds = this.addForm.planConfigDetailVOList.map(
+                  (item) => item.categoryId
+                );
+                await this.getProductList();
+                let list = this.productList.filter((item) =>
+                  categoryIds.includes(item.categoryId)
+                );
+                list.forEach((item) => {
+                  this.$refs.table.toggleRowSelection(item);
+                });
+              } else {
+                this.productList = res.planConfigDetailVOList;
+              }
+            });
+          } else {
+            this.productList = [];
+            this.selection = [];
+            this.addForm = {
+              code: '', // 计划配置单号
+              planName: '', // 计划配置名称
+              categoryId: 0, // 类别ID
+              autoOrder: 1, // 是否自动派单
+              ruleId: '', // 规则名称
+              categoryLevelId: [], // 物品Ids
+              inventoryType: 1, // 盘点类型
+              bizTypeId: '', // 盘点仓库Id
+              bizTypeName: '', // 盘点仓库name
+              verifyUserId: '', // 审核人Id
+              verifyUserName: '', // 审核人name
+              duration: null, // 盘点时长
+              assetDict: '', // 资产分类id
+              assetsName: '', // 资产分类name
+              urgent: '1', // 紧急程度
+              executeGroupId: '', // 执行部门code
+              executeGroupName: '', // 执行部门name
+              executorId: '', // 执行人id
+              executorName: '', // 执行人name
+              isTreasuryLock: false, // 是否锁库盘点
+              enable: 1, // 状态
+              remark: '', // 备注
+              productionLineId: '',
+              productionLineName: '',
+              workshopId: '',
+              workshopName: '',
+              plantId: '',
+              plantName: '',
+              stationId: '',
+              stationName: ''
+            };
+          }
+        }
+      },
+      planRulesDetails(val) {
+        if (!this.dialogVisible) return;
+        this.addForm = val;
+        this.addForm.assetsName = val.assetDictDESC;
+        this.assetsType = val.assetDict;
+        // this.warehousingType.map(item => {
+        //   if (val.assetsName == item.label) {
+        //     this.assetsType = item.code
+        //   }
+        // })
+        // this.assetsType = this.warehousingType.filter(
+        //   item => item.code === val.assetDict.code
+        // )[0].type
+        // this.addForm.assetDict = this.warehousingType.filter(
+        //   item => item.code === val.assetDict.code
+        // )[0].key
+        // 根据部门回显人员
+        const params = { deptCode: val.executeGroupId, status: 1 };
+        this.getUserList(params);
+        this.planRuleInventoryDetailList = val.planRuleInventoryDetailList;
+        console.log(
+          'planRuleInventoryDetailList',
+          this.planRuleInventoryDetailList
+        );
+        // 将 planRuleInventoryDetailList 保存到store,在 assets.vue 中获取用来高亮树节点和请求右边的列表
+        // 取出 planRuleInventoryDetailList 里面的分类 bizTypeId、bizTypeName,用来高亮树节点和请求右边的列表
+        // console.log('资产分类:', val.assetDict)
+        // console.log(this.addForm.assetsName)
+      }
+    },
+    computed: {
+      clientEnvironmentId() {
+        return this.$store.state.user.info.clientEnvironmentId;
+      }
+    },
+    methods: {
+      selecctedRow(val) {
+        this.selection = val;
+      },
+      dimensionChange() {
+        this.selection = [];
+        this.$refs.table.clearSelection();
+        if (this.addForm.warehouseId) {
+          this.getProductList();
+        }
+      },
+      checkSelectable(row) {
+        return true;
+      },
+      async getProductList() {
+        let data = null;
+        if (this.dimension == 1) {
+          data = await getProductList({
+            keyWord: this.keyWord,
+            warehouseId: this.type == 2 ? this.addForm?.warehouseId : '',
+            categoryLevelIds: this.addForm?.categoryLevelId.join(','),
+            pageNum: this.page,
+            size: this.size
+          });
+        } else {
+          data = await getBatchList({
+            keyWord: this.keyWord,
+            warehouseId: this.type == 2 ? this.addForm?.warehouseId : '',
+            categoryLevelIds: this.addForm?.categoryLevelId.join(','),
+            pageNum: this.page,
+            size: this.size
+          });
+        }
+        this.total = data.count;
+        this.productList = data.list;
+      },
+      // 改变规则名称
+      change_ruleId(val) {
+        this.addForm.ruleName = this.ruleNameList.filter(
+          (item) => item.id === val
+        )[0].name;
+      },
+      // 获取工厂数据
+      getFactoryareaList() {
+        getFactoryarea({
+          type: 1,
+          size: 9999,
+          type: 2
+        }).then((res) => {
+          this.factoryOptions = res.list;
+        });
+      },
+      change_factoryId(id) {
+        this.addForm.workshopId = '';
+        this.addForm.productionLineId = '';
+        this.addForm.stationId = '';
+        this.workshopOptions = [];
+        this.productionLineOptions = [];
+        this.stationOptions = [];
+        this.addForm.plantId = id;
+        this.addForm.plantName = this.factoryOptions.filter(
+          (item) => item.id === id
+        )[0].pathName;
+        this.getListWorkshopByParentId(id);
+      },
+      // 获取车间
+      getListWorkshopByParentId(id) {
+        listWorkshopByParentId(id).then((res) => {
+          this.workshopOptions = res;
+        });
+      },
+      change_workshop(id) {
+        this.addForm.productionLineId = '';
+        this.addForm.stationId = '';
+        this.productionLineOptions = [];
+        this.stationOptions = [];
+        this.addForm.workshopName = this.workshopOptions.filter(
+          (item) => item.id === id
+        )[0].name;
+        this.getlistFactoryLineByParentId(id);
+      },
+      // 获取产线
+      getlistFactoryLineByParentId(id) {
+        listFactoryLine([id]).then((res) => {
+          this.productionLineOptions = res;
+        });
+      },
+      change_productionLineId(id) {
+        this.addForm.stationId = '';
+        this.stationOptions = [];
+        this.addForm.productionLineName = this.productionLineOptions.filter(
+          (item) => item.id === id
+        )[0].name;
+        this.getlistByProductionLineId(id);
+      },
+      // 获取工位
+      getlistByProductionLineId(id) {
+        listByProductionLineId(id).then((res) => {
+          this.stationOptions = res;
+        });
+      },
+      change_stationId(id) {
+        this.$forceUpdate();
+        this.addForm.stationName = this.stationOptions.filter(
+          (item) => item.id === id
+        )[0].name;
+      },
+      // 物品类型选择
+      async codeListValue(val) {
+        if (this.addForm.warehouseId) {
+          console.log('val---------', val);
+          this.addForm.categoryLevelId = val;
+          this.getProductList();
+        }
+      },
+      // 获取物品类型列表
+      async getGoodsList() {
+        const { data } = await getTreeByGroup({ type: this.type });
+        console.log('data------', data);
+        this.codeList = data;
+      },
+      // 获取规则名列表
+      async _getRuleNameList() {
+        const res = await getRule({ status: 1, type: 4, pageNum: 1, size: -1 });
+        if (res.list) {
+          this.ruleNameList = res.list || [];
+        }
+      },
+      // 获取计划配置单号
+      async getOrderCode(tips) {
+        const code = await getCode('inventoryconfig_code');
+        this.$set(this.addForm, 'planCode', code);
+      },
+      // 执行人选择
+      changeExecutor(val) {
+        if (val) {
+          this.addForm.executorId = val;
+          this.addForm.executorName = this.executorList.filter(
+            (item) => item.id === val
+          )[0].name;
+        }
+      },
+      // 仓库选择
+      changeWarehouse(val) {
+        if (val) {
+          this.addForm.warehouseId = val;
+          this.addForm.warehouseName = this.warehouseList.filter(
+            (item) => item.id === val
+          )[0].name;
+        }
+        this.getProductList();
+      },
+      // 关闭弹窗
+      handleClose() {
+        this.dialogVisible = false;
+        this.$refs.addFormRef.resetFields();
+        if (this.$refs.searchTree) {
+          this.$refs.searchTree.clearHandle();
+        }
+        if (this.addForm.inventoryType == 2) {
+          this.$refs.assetsRef._clearTreeTableData();
+        }
+        this.addForm.assetsName = '';
+        this.assetsType = null;
+        this.addForm = {
+          code: '', // 计划配置单号
+          planName: '', // 计划配置名称
+          categoryId: 0,
+          autoOrder: 1, // 是否自动派单
+          ruleId: '', // 规则名称
+          inventoryType: '', // 盘点类型
+          bizTypeId: '', // 盘点仓库Id
+          bizTypeName: '', // 盘点仓库name
+          verifyUserId: '', // 审核人Id
+          verifyUserName: '', // 审核人name
+          duration: null, // 盘点时长
+          assetDict: '', // 资产分类id
+          assetsName: '', // 资产分类name
+          urgent: '1', // 紧急程度
+          executeGroupId: '', // 执行部门code
+          executeGroupName: '', // 执行部门name
+          executorId: '', // 执行人id
+          executorName: '', // 执行人name
+          isTreasuryLock: false, // 是否锁库盘点
+          enable: 1, // 状态
+          remark: '' // 备注
+        };
+      },
+
+      // 封装 - 获取盘点仓库
+      async _getWarehouse() {
+        const res = await getWarehouseList({});
+        console.log(res);
+        this.warehouseList = res.map((item) => {
+          return { ...item, name: item.factoryName + '-' + item.name };
+        });
+      },
+
+      //选择部门(搜索)
+      searchDeptNodeClick(info, row) {
+        if (info) {
+          const params = { groupId: info };
+          this.getUserList(params);
+          this.addForm.executeGroupName = row.name;
+        } else {
+          this.addForm.executeGroupId = null;
+        }
+      },
+
+      // 获取审核人列表、巡点检人员
+      async getUserList(params) {
+        try {
+          let data = { pageNum: 1, size: -1 };
+          // 如果传了参数就是获取巡点检人员数据
+          if (params) {
+            data = Object.assign(data, params);
+          }
+          const res = await getUserPage(data);
+          if (params) {
+            this.executorList = res.list;
+          } else {
+            this.uerList = res.list;
+          }
+        } catch (error) {}
+      },
+
+      // 资产分类
+      handleAssetsChange(item) {
+        this.addForm.assetsName = item.dictValue;
+        this.assetsType = item.dictCode;
+        this.$nextTick(
+          () =>
+            this.$refs.assetsRef && this.$refs.assetsRef.handleAssetsChange()
+        );
+      },
+
+      // 参数处理
+      getParams() {
+        const { classificationList, tableSelectionList } =
+          this.$refs.assetsRef.getSelectList();
+        console.log('getParams-tableSelectionList', tableSelectionList);
+        return {
+          ...this.addForm,
+          classificationList: classificationList.map((i) => ({
+            classificationID: i.id,
+            classificationName: i.name
+          })),
+          planRuleInventoryDetailList:
+            this.formData && this.formData.inventoryType === 2
+              ? tableSelectionList.map((item) => ({
+                  assetBrand: item.brand,
+                  assetCode: item.code,
+                  assetId: item.id,
+                  assetLocationId: `${this.initLocation(
+                    item.positionWorkshop
+                  )}${this.initLocation(item.positionLine)}${this.initLocation(
+                    item.positionFarm
+                  )}${this.initLocation(item.positionFactory)}`,
+                  assetLocationName: `${this.initLocation(
+                    item.positionWorkshopCode
+                  )}${this.initLocation(
+                    item.positionLineCode
+                  )}${this.initLocation(
+                    item.positionFarmCode
+                  )}${this.initLocation(item.positionFactoryCode)}`,
+                  assetName: item.name,
+                  assetSku: item.specifications,
+                  assetTypeDict: this.addForm ? this.addForm.assetDict : '',
+                  bizTypeId: item.bizTypeId,
+                  bizTypeName: item.bizTypeName,
+                  unit: this.addForm ? this.addForm.unit : ''
+                }))
+              : tableSelectionList,
+          planRuleType: 'INVENTORY'
+        };
+      },
+      initLocation(inp) {
+        return inp ? inp + ',' : '';
+      },
+
+      // x选择盘点类型
+      chooseType(val) {
+        if (val == 2) {
+          // 库外盘点
+          this.addForm.warehouseId = '';
+          this.addForm.warehouseName = '';
+          this.addForm.lockWarehouse = 0;
+          this.type = 4;
+        } else {
+          // 库内盘点
+          this.addForm.plantId = '';
+          this.addForm.workshopId = '';
+          this.addForm.productionLineId = '';
+          this.addForm.stationId = '';
+          this.workshopOptions = [];
+          this.productionLineOptions = [];
+          this.stationOptions = [];
+          this.type = 2;
+        }
+        this.addForm.categoryLevelId = [];
+        this.getGoodsList();
+      },
+      // 提交
+      // submit() {
+      //   console.log(this.addForm);
+      //   this.$refs.addFormRef.validate(async (valid) => {
+      //     if (valid) {
+      //       // const params = this.getParams();
+      //       // console.log(
+      //       //   'planRuleInventoryDetailList',
+      //       //   params.planRuleInventoryDetailList
+      //       // );
+      //       // if (this.addOrUpdate != 'edit') {
+      //       //   if (
+      //       //     !(
+      //       //       params.classificationList.length ||
+      //       //       params.planRuleInventoryDetailList.length
+      //       //     )
+      //       //   ) {
+      //       //     return this.$message.error('请选择资产分类台账!');
+      //       //   }
+      //       // }
+      //       if (this.addForm.inventoryType == 2) {
+      //         this.addForm.locationId = [
+      //           this.addForm.plantId,
+      //           this.addForm.workshopId,
+      //           this.addForm.productionLineId,
+      //           this.addForm.stationId
+      //         ].join(',');
+      //         this.addForm.locationName = [
+      //           this.addForm.plantName,
+      //           this.addForm.workshopName,
+      //           this.addForm.productionLineName,
+      //           this.addForm.stationName
+      //         ].join(',');
+      //       }
+      //       if (!this.addForm.warehouseId) {
+      //         this.addForm.warehouseId = 0;
+      //       }
+      //       if (this.addForm.inventoryType == 2 && !this.addForm.plantId) {
+      //         this.$message.error('请至少选择所属厂房!');
+      //         return false;
+      //       }
+      //       let res = '';
+      //       let message = '';
+      //       if (this.dialogTile === '修改盘点计划配置') {
+      //         res = await updateStocktakingPlan(this.addForm);
+      //         message = '修改成功!';
+      //       } else {
+      //         res = await saveStocktakingPlan(this.addForm);
+      //         message = '新增成功!';
+      //       }
+      //       if (res.code == 0) {
+      //         this.handleClose();
+      //         this.$message.success(message);
+      //         this.$emit('refreshList');
+      //       }
+      //     }
+      //   });
+      // },
+      submit() {
+        console.log(this.addForm);
+        this.$refs.addFormRef.validate(async (valid) => {
+          let res = null;
+          if (valid) {
+            if (this.dialogTile === '修改盘点计划配置') {
+            } else {
+              if (this.selection?.length > 0) {
+                res = await saveStocktakingPlan({
+                  ...this.addForm,
+                  categoryLevelId: this.addForm.categoryLevelId.join(','),
+                  details: this.selection.map((item) => {
+                    return {
+                      batchNo: item.batchNo,
+                      categoryId: item.categoryId,
+                      categoryName: item.categoryName
+                    };
+                  })
+                });
+              } else {
+                return this.$message.error('请选择需要盘点物品');
+              }
+              console.log(this.addForm);
+            }
+            if (res.code == 0) {
+              this.handleClose();
+              this.$message.success(res.message);
+              this.$emit('refreshList');
+            }
+          }
+        });
+      },
+      handleChangeassetDict(data) {
+        console.log(data);
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  ::v-deep .el-row {
+    display: flex;
+    flex-wrap: wrap;
+  }
+  .add_form {
+    ::v-deep .el-form-item {
+      margin-bottom: 20px !important;
+    }
+  }
+  .table_search {
+    margin-bottom: 5px;
+  }
+</style>

+ 1054 - 0
src/views/rulesManagement/warehouseInventory/components/addInventoryDialog.vue

@@ -0,0 +1,1054 @@
+<template>
+  <el-dialog
+    :visible.sync="dialogVisible"
+    :title="dialogTile"
+    :before-close="handleClose"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    v-loading="addDialogLoading"
+    width="80%"
+  >
+    <HeaderTitle title="基本信息" size="16px"></HeaderTitle>
+    <el-form
+      :model="addForm"
+      class="add_form"
+      ref="addFormRef"
+      :rules="rules"
+      label-width="110px"
+    >
+      <el-row :gutter="20">
+        <el-col :span="8">
+          <el-form-item label="计划配置单号" prop="code">
+            <el-input
+              v-model="addForm.planCode"
+              placeholder="自动生成"
+              disabled
+            ></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="计划配置名称" prop="planName">
+            <el-input
+              v-model="addForm.planName"
+              placeholder="请输入"
+              :disabled="isBindPlan"
+            ></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="自动派单" prop="autoOrder">
+            <el-select
+              v-model="addForm.autoOrder"
+              class="w100"
+              placeholder="请选择"
+              :disabled="isBindPlan"
+              filterable
+            >
+              <el-option :value="1" label="是"></el-option>
+              <el-option :value="0" label="否"></el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="规则名称" prop="ruleId">
+            <el-select
+              v-model="addForm.ruleId"
+              class="w100"
+              placeholder="请选择规则名称"
+              @change="change_ruleId"
+              :disabled="isBindPlan"
+              filterable
+            >
+              <el-option
+                v-for="item in ruleNameList"
+                :key="item.id"
+                :value="item.id"
+                :label="item.name"
+                @click.native="addForm.ruleName = item.name"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="计划盘点时长" prop="duration">
+            <el-input
+              v-model.number="addForm.duration"
+              placeholder="请输入"
+              :disabled="isBindPlan"
+            >
+              <template #suffix>分钟</template>
+            </el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="盘点类型" prop="inventoryType">
+            <el-select
+              v-model="addForm.inventoryType"
+              class="w100"
+              placeholder="请选择"
+              @change="chooseType"
+              disabled
+              filterable
+            >
+              <el-option
+                v-for="item in inventoryTypeStatus"
+                :key="item.code"
+                :value="item.code"
+                :label="item.label"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col v-if="addForm.inventoryType == 1" :span="8">
+          <el-form-item label="盘点仓库" prop="warehouseId">
+            <el-select
+              placeholder="请选择"
+              class="w100"
+              :disabled="isBindPlan"
+              v-model="addForm.warehouseId"
+              @change="changeWarehouse"
+              filterable
+            >
+              <el-option
+                v-for="item in warehouseList"
+                :key="item.id"
+                :value="item.id"
+                :label="item.name"
+                @click.native="
+                  () => {
+                    addForm.bizTypeName = item.name;
+                  }
+                "
+              ></el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <!-- <el-col :span="8">
+          <el-form-item label="审核人" prop="verifyUserId">
+            <el-select
+              v-model="addForm.verifyUserId"
+              size="small"
+              style="width: 100%"
+              :disabled="isBindPlan"
+              filterable
+            >
+              <el-option
+                v-for="item in uerList"
+                :key="item.id"
+                :value="item.id"
+                :label="item.name"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+        </el-col> -->
+
+        <el-col :span="8">
+          <el-form-item
+            :label="type == 2 ? '产品分类' : '资产分类'"
+            prop="categoryLevelId"
+          >
+            <ele-tree-select
+              multiple
+              clearable
+              :disabled="isBindPlan"
+              :data="codeList"
+              @change="codeListValue"
+              v-model="addForm.categoryLevelId"
+              valueKey="id"
+              labelKey="name"
+              :show-checkbox="true"
+              :check-strictly="true"
+              filterable
+              placeholder="请选择"
+            />
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="紧急程度" prop="urgent">
+            <DictSelection
+              :isProhibit="isBindPlan"
+              dictName="紧急程度"
+              clearable
+              filterable
+              v-model="addForm.urgent"
+            >
+            </DictSelection>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8" v-if="addForm.autoOrder">
+          <el-form-item label="执行部门" prop="executeGroupId">
+            <deptSelect
+              :isBindPlan="isBindPlan"
+              v-model="addForm.executeGroupId"
+              @changeGroup="searchDeptNodeClick"
+            />
+          </el-form-item>
+        </el-col>
+        <el-col :span="8" v-if="addForm.autoOrder">
+          <el-form-item label="执行人员" prop="executorId">
+            <el-select
+              v-model="addForm.executorId"
+              @change="changeExecutor"
+              :disabled="isBindPlan"
+              size="small"
+              style="width: 100%"
+              filterable
+            >
+              <el-option
+                v-for="item in executorList"
+                :key="item.id"
+                :value="item.id"
+                :label="item.name"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col v-if="addForm.inventoryType == 1" :span="8">
+          <el-form-item label="锁库盘点" prop="isTreasuryLock">
+            <el-switch
+              v-model="addForm.lockWarehouse"
+              active-text="开"
+              inactive-text="关"
+              :active-value="1"
+              :inactive-value="0"
+              :disabled="isBindPlan"
+            ></el-switch>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="状态" prop="enable">
+            <el-switch
+              v-model="addForm.enable"
+              :disabled="isBindPlan"
+              active-text="开"
+              inactive-text="关"
+              :active-value="1"
+              :inactive-value="0"
+            ></el-switch>
+          </el-form-item>
+        </el-col>
+        <el-col :span="24">
+          <el-form-item label="备注" prop="remark">
+            <el-input
+              placeholder="请输入"
+              type="textarea"
+              :rows="2"
+              resize="none"
+              v-model="addForm.remark"
+              :disabled="isBindPlan"
+            ></el-input>
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <HeaderTitle title="盘点物品信息" size="16px">
+        <el-select
+          style="margin-right: 10px"
+          :disabled="isBindPlan"
+          @change="dimensionChange"
+          v-model="dimension"
+          placeholder="请选择维度"
+        >
+          <el-option label="物品维度" :value="1"> </el-option>
+          <el-option label="批次维度" :value="2"> </el-option>
+        </el-select>
+        <el-button type="primary" @click="addProducts">添加物品</el-button>
+      </HeaderTitle>
+      <el-table
+        ref="table"
+        :data="productList"
+        :height="500"
+        row-key="id"
+        tooltip-effect="dark"
+        border
+      >
+        <el-table-column label="序号" type="index" width="50">
+        </el-table-column>
+        <el-table-column
+          label="物品编码"
+          prop="categoryCode"
+          :show-overflow-tooltip="true"
+        ></el-table-column>
+        <el-table-column
+          label="物品名称"
+          prop="categoryName"
+          :show-overflow-tooltip="true"
+        ></el-table-column>
+        <el-table-column
+          label="批次号"
+          prop="batchNo"
+          :show-overflow-tooltip="true"
+        ></el-table-column>
+        <el-table-column
+          label="牌号"
+          prop="brandNum"
+          :show-overflow-tooltip="true"
+        ></el-table-column>
+        <el-table-column
+          label="型号"
+          prop="categoryModel"
+          :show-overflow-tooltip="true"
+        ></el-table-column>
+        <el-table-column
+          label="规格"
+          prop="specification"
+          :show-overflow-tooltip="true"
+        ></el-table-column>
+        <el-table-column
+          label="计量数量"
+          prop="measureQuantity"
+          :show-overflow-tooltip="true"
+        ></el-table-column>
+        <el-table-column
+          label="计量单位"
+          prop="measureUnit"
+          :show-overflow-tooltip="true"
+        ></el-table-column>
+        <el-table-column
+          label="重量"
+          prop="weight"
+          :show-overflow-tooltip="true"
+        >
+        </el-table-column>
+        <el-table-column
+          label="重量单位"
+          prop="weightUnit"
+          :show-overflow-tooltip="true"
+        >
+        </el-table-column>
+        <el-table-column v-if="!isBindPlan" label="操作" width="100">
+          <template slot-scope="{ row, $index }">
+            <el-button @click="deleted(row, $index)" type="text" size="small"
+              >删除</el-button
+            >
+          </template>
+        </el-table-column>
+      </el-table>
+      <!-- 库外 -->
+      <!-- <Assets
+        ref="assetsRef"
+        :assetsName="addForm.assetsName"
+        :assetsType="assetsType"
+        :planRuleInventoryDetailList="planRuleInventoryDetailList"
+        :isBindPlan = "isBindPlan"
+        v-if="
+          addForm.bizType === 2 &&
+          addForm.assetsName != '物料' &&
+          addForm.assetsName != '产品' &&
+          addForm.assetsName != '备品备件'
+        "
+      /> -->
+      <!-- 库内 库存台账 -->
+      <AssetsInWarehouse
+        ref="assetsRef"
+        :assetsName="addForm.assetsName"
+        :warehouseId="addForm.bizTypeId"
+        :assetsType="assetsType"
+        :bizType="addForm.inventoryType"
+        :planRuleInventoryDetailList="planRuleInventoryDetailList"
+        :isBindPlan="isBindPlan"
+      />
+    </el-form>
+    <div v-if="!isBindPlan" slot="footer">
+      <el-button type="primary" size="small" @click="submit">提交</el-button>
+      <el-button size="small" @click="handleClose">关闭</el-button>
+    </div>
+    <div v-else slot="footer">
+      <el-button type="primary" size="small" @click="dialogVisible = false"
+        >确定</el-button
+      >
+      <el-button size="small" @click="dialogVisible = false">关闭</el-button>
+    </div>
+    <selectType
+      :visibleDialog.sync="visibleDialog"
+      :treeIds="addForm.categoryLevelId"
+      :dimension="dimension"
+      :warehouseId="addForm.warehouseId"
+      :selectionIds="selectionIds"
+      :loadTree.sync="loadTree"
+      @selectTableData="addGoods"
+    />
+  </el-dialog>
+</template>
+
+<script>
+  import { getFactoryarea } from '@/api/factoryModel';
+  import { listWorkshopByParentId, listFactoryLine } from '@/api/factoryModel';
+  import { listByProductionLineId } from '@/api/workforceManagement/team';
+  import selectTree from '@/components/selectTree/index_other.vue';
+  import { getTreeByGroup } from '@/api/classifyManage';
+  import { inventoryTypeStatus } from '@/utils/dict/rulesManagement';
+  import selectType from './selectType.vue';
+  import { mapGetters } from 'vuex';
+  // import { wh_checkStatus} from '@/utils/dict/warehouse'
+  import { getCode } from '@/api/ruleManagement/matter';
+  import AssetsInWarehouse from './AssetsInWarehouse';
+  import { fieldModel } from '@/api/codeManagement';
+  import {
+    getRule,
+    getProductList,
+    getBatchList,
+    getWarehouseList,
+    saveStocktakingPlan,
+    updateStocktakingPlan,
+    getInventoryDetailById
+  } from '@/api/ruleManagement/plan';
+  import { getUserPage } from '@/api/system/organization';
+  import deptSelect from '@/components/CommomSelect/dept-select.vue';
+  export default {
+    props: {
+      dialogTile: {
+        type: String,
+        default: '新增盘点计划配置'
+      },
+      isBindPlan: {
+        type: Boolean,
+        default: function () {
+          return false;
+        }
+      },
+      id: {
+        type: String,
+        default: ''
+      }
+    },
+    components: {
+      deptSelect,
+      AssetsInWarehouse,
+      selectTree,
+      selectType
+    },
+    data() {
+      return {
+        visibleDialog: false,
+        type: 2, // 盘点类型 2仓储 4资产
+        dimension: 1, // 盘点维度1物品 2批次
+        factoryOptions: [],
+        workshopOptions: [],
+        productionLineOptions: [],
+        stationOptions: [],
+        codeList: [],
+        inventoryTypeStatus,
+        addDialogLoading: false,
+        dialogVisible: false,
+        wh_checkStatus: [], // 盘点类型
+        warehouseList: [], // 盘点仓库
+        uerList: [], // 审核人
+        executorList: [], // 执行人
+        assetsType: null,
+        planRuleInventoryDetailList: [],
+        tableList: [],
+        newColumns: [],
+        selection: [],
+        keyWord: '',
+        total: 0,
+        page: 1,
+        size: 10,
+        loadTree: true,
+        productList: [],
+        addForm: {
+          code: '', // 计划配置单号
+          planName: '', // 计划配置名称
+          categoryId: 0, // 类别ID
+          autoOrder: 1, // 是否自动派单
+          ruleId: '', // 规则名称
+          categoryLevelId: [], // 物品Ids
+          inventoryType: 1, // 盘点类型
+          bizTypeId: '', // 盘点仓库Id
+          bizTypeName: '', // 盘点仓库name
+          verifyUserId: '', // 审核人Id
+          verifyUserName: '', // 审核人name
+          duration: null, // 盘点时长
+          assetDict: '', // 资产分类id
+          assetsName: '', // 资产分类name
+          urgent: '1', // 紧急程度
+          executeGroupId: '', // 执行部门code
+          executeGroupName: '', // 执行部门name
+          executorId: '', // 执行人id
+          executorName: '', // 执行人name
+          isTreasuryLock: false, // 是否锁库盘点
+          enable: 1, // 状态
+          remark: '', // 备注
+          productionLineId: '',
+          productionLineName: '',
+          workshopId: '',
+          workshopName: '',
+          plantId: '',
+          plantName: '',
+          stationId: '',
+          stationName: ''
+        },
+        rules: {
+          planName: [
+            { required: true, message: '请输入计划配置名称', trigger: 'blur' }
+          ],
+          autoOrder: [
+            { required: true, message: '请选择是否自动派单', trigger: 'change' }
+          ],
+          ruleId: [
+            { required: true, message: '请选择规则名称', trigger: 'change' }
+          ],
+          duration: [
+            { required: true, message: '请输入计划完成时长', trigger: 'blur' }
+          ],
+          inventoryType: [
+            { required: true, message: '请选择盘点类型', trigger: 'change' }
+          ],
+          // plantId: [
+          //   {
+          //     required: true,
+          //     message: '请选择厂房',
+          //     trigger: 'change'
+          //   }
+          // ],
+          warehouseId: [
+            { required: true, message: '请选择盘点仓库', trigger: 'change' }
+          ],
+          verifyUserId: [
+            { required: false, message: '请选择审核人', trigger: 'change' }
+          ],
+          executeGroupId: [
+            { required: true, message: '请选择选择执行部门', trigger: 'change' }
+          ],
+          executorId: [
+            { required: true, message: '请选择选择执行人员', trigger: 'change' }
+          ],
+          assetDict: [
+            { required: true, message: '请选择资产分类', trigger: 'change' }
+          ]
+        },
+        ruleNameList: []
+      };
+    },
+    watch: {
+      dialogVisible(val) {
+        if (val) {
+          // // 获取审核人列表数据
+          // this.getUserList();
+          // 获取盘点仓库
+          this._getWarehouse();
+          // 获取计划单号
+          this.getOrderCode();
+          // 获取规则名称
+          this._getRuleNameList();
+          // 获取物品类型
+          this.getGoodsList();
+          // 获取工厂列表
+          this.getFactoryareaList();
+          if (
+            this.dialogTile === '修改盘点计划配置' ||
+            this.dialogTile === '盘点计划配置详情'
+          ) {
+            getInventoryDetailById(this.id).then(async (res) => {
+              console.log(res);
+              res.warehouseId = res.warehouseId > 0 ? res.warehouseId : '';
+              res.urgent = String(res.urgent);
+              res.categoryLevelId = res.categoryLevelId
+                ? res.categoryLevelId.split(',')
+                : [];
+              this.addForm = res;
+              this.dimension = res.planConfigDetailVOList[0].batch_no ? 2 : 1;
+              if (this.addForm.executeGroupId) {
+                this.getUserList({ groupId: this.addForm.executeGroupId });
+              }
+              this.productList = res.planConfigDetailVOList;
+            });
+          } else {
+            this.productList = [];
+            this.addForm = {
+              code: '', // 计划配置单号
+              planName: '', // 计划配置名称
+              categoryId: 0, // 类别ID
+              autoOrder: 1, // 是否自动派单
+              ruleId: '', // 规则名称
+              categoryLevelId: [], // 物品Ids
+              inventoryType: 1, // 盘点类型
+              bizTypeId: '', // 盘点仓库Id
+              bizTypeName: '', // 盘点仓库name
+              verifyUserId: '', // 审核人Id
+              verifyUserName: '', // 审核人name
+              duration: null, // 盘点时长
+              assetDict: '', // 资产分类id
+              assetsName: '', // 资产分类name
+              urgent: '1', // 紧急程度
+              executeGroupId: '', // 执行部门code
+              executeGroupName: '', // 执行部门name
+              executorId: '', // 执行人id
+              executorName: '', // 执行人name
+              isTreasuryLock: false, // 是否锁库盘点
+              enable: 1, // 状态
+              remark: '', // 备注
+              productionLineId: '',
+              productionLineName: '',
+              workshopId: '',
+              workshopName: '',
+              plantId: '',
+              plantName: '',
+              stationId: '',
+              stationName: ''
+            };
+          }
+        }
+      },
+      planRulesDetails(val) {
+        if (!this.dialogVisible) return;
+        this.addForm = val;
+        this.addForm.assetsName = val.assetDictDESC;
+        this.assetsType = val.assetDict;
+        // this.warehousingType.map(item => {
+        //   if (val.assetsName == item.label) {
+        //     this.assetsType = item.code
+        //   }
+        // })
+        // this.assetsType = this.warehousingType.filter(
+        //   item => item.code === val.assetDict.code
+        // )[0].type
+        // this.addForm.assetDict = this.warehousingType.filter(
+        //   item => item.code === val.assetDict.code
+        // )[0].key
+        // 根据部门回显人员
+        const params = { deptCode: val.executeGroupId, status: 1 };
+        this.getUserList(params);
+        this.planRuleInventoryDetailList = val.planRuleInventoryDetailList;
+        console.log(
+          'planRuleInventoryDetailList',
+          this.planRuleInventoryDetailList
+        );
+        // 将 planRuleInventoryDetailList 保存到store,在 assets.vue 中获取用来高亮树节点和请求右边的列表
+        // 取出 planRuleInventoryDetailList 里面的分类 bizTypeId、bizTypeName,用来高亮树节点和请求右边的列表
+        // console.log('资产分类:', val.assetDict)
+        // console.log(this.addForm.assetsName)
+      }
+    },
+    computed: {
+      clientEnvironmentId() {
+        return this.$store.state.user.info.clientEnvironmentId;
+      },
+      selectionIds() {
+        return this.productList.map((item) => item.categoryId);
+      }
+    },
+    methods: {
+      // 添加物品明细
+      async addGoods(data) {
+        console.log(data);
+        let productList = data.map((item) => {
+          return {
+            ...item
+          };
+        });
+        this.productList = this.productList.concat(productList);
+      },
+      addProducts() {
+        this.visibleDialog = true;
+      },
+      deleted(row, index) {
+        this.productList.splice(index, 1);
+      },
+      selecctedRow(val) {
+        this.selection = val;
+      },
+      dimensionChange() {
+        this.productList = [];
+      },
+      checkSelectable(row) {
+        return true;
+      },
+      async getProductList() {
+        let data = null;
+        if (this.dimension == 1) {
+          data = await getProductList({
+            keyWord: this.keyWord,
+            warehouseId: this.type == 2 ? this.addForm?.warehouseId : '',
+            categoryLevelIds: this.addForm?.categoryLevelId.join(','),
+            pageNum: this.page,
+            size: this.size
+          });
+        } else {
+          data = await getBatchList({
+            keyWord: this.keyWord,
+            warehouseId: this.type == 2 ? this.addForm?.warehouseId : '',
+            categoryLevelIds: this.addForm?.categoryLevelId.join(','),
+            pageNum: this.page,
+            size: this.size
+          });
+        }
+        this.total = data.count;
+        this.productList = data.list;
+      },
+      // 改变规则名称
+      change_ruleId(val) {
+        this.addForm.ruleName = this.ruleNameList.filter(
+          (item) => item.id === val
+        )[0].name;
+      },
+      // 获取工厂数据
+      getFactoryareaList() {
+        getFactoryarea({
+          type: 1,
+          size: 9999,
+          type: 2
+        }).then((res) => {
+          this.factoryOptions = res.list;
+        });
+      },
+      change_factoryId(id) {
+        this.addForm.workshopId = '';
+        this.addForm.productionLineId = '';
+        this.addForm.stationId = '';
+        this.workshopOptions = [];
+        this.productionLineOptions = [];
+        this.stationOptions = [];
+        this.addForm.plantId = id;
+        this.addForm.plantName = this.factoryOptions.filter(
+          (item) => item.id === id
+        )[0].pathName;
+        this.getListWorkshopByParentId(id);
+      },
+      // 获取车间
+      getListWorkshopByParentId(id) {
+        listWorkshopByParentId(id).then((res) => {
+          this.workshopOptions = res;
+        });
+      },
+      change_workshop(id) {
+        this.addForm.productionLineId = '';
+        this.addForm.stationId = '';
+        this.productionLineOptions = [];
+        this.stationOptions = [];
+        this.addForm.workshopName = this.workshopOptions.filter(
+          (item) => item.id === id
+        )[0].name;
+        this.getlistFactoryLineByParentId(id);
+      },
+      // 获取产线
+      getlistFactoryLineByParentId(id) {
+        listFactoryLine([id]).then((res) => {
+          this.productionLineOptions = res;
+        });
+      },
+      change_productionLineId(id) {
+        this.addForm.stationId = '';
+        this.stationOptions = [];
+        this.addForm.productionLineName = this.productionLineOptions.filter(
+          (item) => item.id === id
+        )[0].name;
+        this.getlistByProductionLineId(id);
+      },
+      // 获取工位
+      getlistByProductionLineId(id) {
+        listByProductionLineId(id).then((res) => {
+          this.stationOptions = res;
+        });
+      },
+      change_stationId(id) {
+        this.$forceUpdate();
+        this.addForm.stationName = this.stationOptions.filter(
+          (item) => item.id === id
+        )[0].name;
+      },
+      // 物品类型选择
+      async codeListValue(val) {
+        if (this.addForm.warehouseId) {
+          console.log('val---------', val);
+          this.addForm.categoryLevelId = val;
+        }
+      },
+      // 获取物品类型列表
+      async getGoodsList() {
+        const { data } = await getTreeByGroup({ type: this.type });
+        console.log('data------', data);
+        this.codeList = data;
+      },
+      // 获取规则名列表
+      async _getRuleNameList() {
+        const res = await getRule({ status: 1, type: 4, pageNum: 1, size: -1 });
+        if (res.list) {
+          this.ruleNameList = res.list || [];
+        }
+      },
+      // 获取计划配置单号
+      async getOrderCode(tips) {
+        const code = await getCode('inventoryconfig_code');
+        this.$set(this.addForm, 'planCode', code);
+      },
+      // 执行人选择
+      changeExecutor(val) {
+        if (val) {
+          this.addForm.executorId = val;
+          this.addForm.executorName = this.executorList.filter(
+            (item) => item.id === val
+          )[0].name;
+        }
+      },
+      // 仓库选择
+      changeWarehouse(val) {
+        if (val) {
+          this.addForm.warehouseId = val;
+          this.addForm.warehouseName = this.warehouseList.filter(
+            (item) => item.id === val
+          )[0].name;
+        }
+      },
+      // 关闭弹窗
+      handleClose() {
+        this.dialogVisible = false;
+        this.$refs.addFormRef.resetFields();
+        if (this.$refs.searchTree) {
+          this.$refs.searchTree.clearHandle();
+        }
+        if (this.addForm.inventoryType == 2) {
+          this.$refs.assetsRef._clearTreeTableData();
+        }
+        this.addForm.assetsName = '';
+        this.assetsType = null;
+        this.addForm = {
+          code: '', // 计划配置单号
+          planName: '', // 计划配置名称
+          categoryId: 0,
+          autoOrder: 1, // 是否自动派单
+          ruleId: '', // 规则名称
+          inventoryType: '', // 盘点类型
+          bizTypeId: '', // 盘点仓库Id
+          bizTypeName: '', // 盘点仓库name
+          verifyUserId: '', // 审核人Id
+          verifyUserName: '', // 审核人name
+          duration: null, // 盘点时长
+          assetDict: '', // 资产分类id
+          assetsName: '', // 资产分类name
+          urgent: '1', // 紧急程度
+          executeGroupId: '', // 执行部门code
+          executeGroupName: '', // 执行部门name
+          executorId: '', // 执行人id
+          executorName: '', // 执行人name
+          isTreasuryLock: false, // 是否锁库盘点
+          enable: 1, // 状态
+          remark: '' // 备注
+        };
+      },
+
+      // 封装 - 获取盘点仓库
+      async _getWarehouse() {
+        const res = await getWarehouseList({});
+        console.log(res);
+        this.warehouseList = res.map((item) => {
+          return { ...item, name: item.factoryName + '-' + item.name };
+        });
+      },
+
+      //选择部门(搜索)
+      searchDeptNodeClick(info, row) {
+        if (info) {
+          const params = { groupId: info };
+          this.getUserList(params);
+          this.addForm.executeGroupName = row.name;
+        } else {
+          this.addForm.executeGroupId = null;
+        }
+      },
+
+      // 获取审核人列表、巡点检人员
+      async getUserList(params) {
+        try {
+          let data = { pageNum: 1, size: -1 };
+          // 如果传了参数就是获取巡点检人员数据
+          if (params) {
+            data = Object.assign(data, params);
+          }
+          const res = await getUserPage(data);
+          if (params) {
+            this.executorList = res.list;
+          } else {
+            this.uerList = res.list;
+          }
+        } catch (error) {}
+      },
+
+      // 资产分类
+      handleAssetsChange(item) {
+        this.addForm.assetsName = item.dictValue;
+        this.assetsType = item.dictCode;
+        this.$nextTick(
+          () =>
+            this.$refs.assetsRef && this.$refs.assetsRef.handleAssetsChange()
+        );
+      },
+
+      // 参数处理
+      getParams() {
+        const { classificationList, tableSelectionList } =
+          this.$refs.assetsRef.getSelectList();
+        console.log('getParams-tableSelectionList', tableSelectionList);
+        return {
+          ...this.addForm,
+          classificationList: classificationList.map((i) => ({
+            classificationID: i.id,
+            classificationName: i.name
+          })),
+          planRuleInventoryDetailList:
+            this.formData && this.formData.inventoryType === 2
+              ? tableSelectionList.map((item) => ({
+                  assetBrand: item.brand,
+                  assetCode: item.code,
+                  assetId: item.id,
+                  assetLocationId: `${this.initLocation(
+                    item.positionWorkshop
+                  )}${this.initLocation(item.positionLine)}${this.initLocation(
+                    item.positionFarm
+                  )}${this.initLocation(item.positionFactory)}`,
+                  assetLocationName: `${this.initLocation(
+                    item.positionWorkshopCode
+                  )}${this.initLocation(
+                    item.positionLineCode
+                  )}${this.initLocation(
+                    item.positionFarmCode
+                  )}${this.initLocation(item.positionFactoryCode)}`,
+                  assetName: item.name,
+                  assetSku: item.specifications,
+                  assetTypeDict: this.addForm ? this.addForm.assetDict : '',
+                  bizTypeId: item.bizTypeId,
+                  bizTypeName: item.bizTypeName,
+                  unit: this.addForm ? this.addForm.unit : ''
+                }))
+              : tableSelectionList,
+          planRuleType: 'INVENTORY'
+        };
+      },
+      initLocation(inp) {
+        return inp ? inp + ',' : '';
+      },
+
+      // x选择盘点类型
+      chooseType(val) {
+        if (val == 2) {
+          // 库外盘点
+          this.addForm.warehouseId = '';
+          this.addForm.warehouseName = '';
+          this.addForm.lockWarehouse = 0;
+          this.type = 4;
+        } else {
+          // 库内盘点
+          this.addForm.plantId = '';
+          this.addForm.workshopId = '';
+          this.addForm.productionLineId = '';
+          this.addForm.stationId = '';
+          this.workshopOptions = [];
+          this.productionLineOptions = [];
+          this.stationOptions = [];
+          this.type = 2;
+        }
+        this.addForm.categoryLevelId = [];
+        this.getGoodsList();
+      },
+      // 提交
+      // submit() {
+      //   console.log(this.addForm);
+      //   this.$refs.addFormRef.validate(async (valid) => {
+      //     if (valid) {
+      //       // const params = this.getParams();
+      //       // console.log(
+      //       //   'planRuleInventoryDetailList',
+      //       //   params.planRuleInventoryDetailList
+      //       // );
+      //       // if (this.addOrUpdate != 'edit') {
+      //       //   if (
+      //       //     !(
+      //       //       params.classificationList.length ||
+      //       //       params.planRuleInventoryDetailList.length
+      //       //     )
+      //       //   ) {
+      //       //     return this.$message.error('请选择资产分类台账!');
+      //       //   }
+      //       // }
+      //       if (this.addForm.inventoryType == 2) {
+      //         this.addForm.locationId = [
+      //           this.addForm.plantId,
+      //           this.addForm.workshopId,
+      //           this.addForm.productionLineId,
+      //           this.addForm.stationId
+      //         ].join(',');
+      //         this.addForm.locationName = [
+      //           this.addForm.plantName,
+      //           this.addForm.workshopName,
+      //           this.addForm.productionLineName,
+      //           this.addForm.stationName
+      //         ].join(',');
+      //       }
+      //       if (!this.addForm.warehouseId) {
+      //         this.addForm.warehouseId = 0;
+      //       }
+      //       if (this.addForm.inventoryType == 2 && !this.addForm.plantId) {
+      //         this.$message.error('请至少选择所属厂房!');
+      //         return false;
+      //       }
+      //       let res = '';
+      //       let message = '';
+      //       if (this.dialogTile === '修改盘点计划配置') {
+      //         res = await updateStocktakingPlan(this.addForm);
+      //         message = '修改成功!';
+      //       } else {
+      //         res = await saveStocktakingPlan(this.addForm);
+      //         message = '新增成功!';
+      //       }
+      //       if (res.code == 0) {
+      //         this.handleClose();
+      //         this.$message.success(message);
+      //         this.$emit('refreshList');
+      //       }
+      //     }
+      //   });
+      // },
+      submit() {
+        console.log(this.addForm);
+        this.$refs.addFormRef.validate(async (valid) => {
+          let res = null;
+          if (valid) {
+            let params = {
+              ...this.addForm,
+              categoryLevelId: this.addForm.categoryLevelId.join(','),
+              details: this.productList.map((item) => {
+                return {
+                  batchNo: item.batchNo,
+                  categoryId: item.categoryId,
+                  categoryName: item.categoryName
+                };
+              })
+            };
+            if (this.productList?.length > 0) {
+              if (this.dialogTile === '修改盘点计划配置') {
+                res = await updateStocktakingPlan(params);
+              } else {
+                res = await saveStocktakingPlan(params);
+              }
+            } else {
+              return this.$message.error('请选择需要盘点物品');
+            }
+
+            if (res.code == 0) {
+              this.handleClose();
+              this.$message.success(res.message);
+              this.$emit('refreshList');
+            }
+          }
+        });
+      },
+      handleChangeassetDict(data) {
+        console.log(data);
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  ::v-deep .el-row {
+    display: flex;
+    flex-wrap: wrap;
+  }
+  .add_form {
+    ::v-deep .el-form-item {
+      margin-bottom: 20px !important;
+    }
+  }
+  .table_search {
+    margin-bottom: 5px;
+  }
+</style>

+ 124 - 0
src/views/rulesManagement/warehouseInventory/components/assetTree.vue

@@ -0,0 +1,124 @@
+<template>
+  <div class="tree-wrapper">
+    <el-tree
+      :data="treeList"
+      :props="defaultProps"
+      v-loading="treeLoading"
+      :node-key="nodeKey"
+      ref="tree"
+      :highlight-current="true"
+      :expand-on-click-node="false"
+      @node-click="handleNodeClick"
+      :default-expanded-keys="current && current.id ? [current.id] : []"
+    >
+    </el-tree>
+  </div>
+</template>
+
+<script>
+  import { getTreeByIds } from '@/api/classifyManage';
+
+  export default {
+    props: {
+      defaultProps: {
+        type: Object,
+        default: function () {
+          return {
+            children: 'children',
+            value: 'id',
+            label: 'name'
+          };
+        }
+      },
+
+      // 初始请求treeList
+      init: {
+        type: Boolean,
+        default: true
+      },
+
+      treeIds: {
+        type: Array,
+        default: []
+      },
+      nodeKey: {
+        type: String,
+        default: 'id'
+      }
+    },
+    data() {
+      return {
+        treeList: [],
+        treeLoading: false,
+        current: {},
+        currentKey: ''
+      };
+    },
+    mounted() {
+      if (this.init) {
+        this.getTreeData();
+      }
+    },
+    methods: {
+      // 获取树结构数据
+      getTreeData() {
+        return new Promise(async (resolve) => {
+          try {
+            this.treeLoading = true;
+
+            const res = await getTreeByIds({ ids: this.treeIds.join(',') });
+            this.treeLoading = false;
+            if (res?.code === '0') {
+              this.treeList = res.data;
+              this.$emit('setRootId', res.data[0]);
+
+              this.$nextTick(() => {
+                // 默认高亮第一级树节点
+                if (this.treeList[0]) {
+                  this.setCurrentKey(this.treeList[0]);
+                  this.current = this.treeList[0];
+                  // 默认点击加载数据
+                  // const firstNode = document.querySelector('.el-tree-node');
+                  // firstNode.click();
+                  resolve(this.current);
+                }
+              });
+              return this.treeList;
+            }
+          } catch (error) {
+            console.log(error);
+          }
+          this.treeLoading = false;
+        });
+      },
+
+      handleNodeClick(data, node) {
+        this.$emit('handleNodeClick', data, node);
+      },
+      // 设置默认高亮行
+      setCurrentKey(id) {
+        this.currentKey = id;
+        this.$refs.tree.setCurrentKey(this.currentKey);
+      },
+
+      // 获取树的选中状态
+      getSelectList() {
+        const selectList = this.$refs.tree.getCurrentNode();
+        return selectList;
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .tree-wrapper {
+    width: 100%;
+    height: 100%;
+    overflow: auto;
+
+    :deep(.el-tree) {
+      display: inline-block;
+      min-width: 100%;
+    }
+  }
+</style>

+ 200 - 0
src/views/rulesManagement/warehouseInventory/components/inventory-search.vue

@@ -0,0 +1,200 @@
+<!-- 搜索表单 -->
+<template>
+  <el-form
+    label-width="100px"
+    class="ele-form-search"
+    @keyup.enter.native="search"
+    @submit.native.prevent
+  >
+    <el-row :gutter="15">
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+        <el-form-item label="计划配置单号:">
+          <el-input clearable v-model.trim="where.planCode" placeholder="请输入" />
+        </el-form-item>
+        <el-form-item label="分类:">
+          <selectTree
+            ref="tree"
+            class="form-ipt"
+            size="medium"
+            style="width: 100%"
+            clearable
+            :options="codeList"
+            :props="{
+              value: 'id',
+              label: 'name',
+              children: 'children'
+            }"
+            @getValue="codeListValue"
+            :isAll="false"
+          />
+          <!-- <DictSelection dictName="类型用途" clearable v-model.trim="where.staus">
+			</DictSelection> -->
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+        <el-form-item label="盘点名称:">
+          <el-input clearable v-model.trim="where.planName" placeholder="请输入" />
+        </el-form-item>
+        <el-form-item label="规则名称:">
+          <el-select
+            v-model.trim="where.ruleId"
+            class="w100"
+            placeholder="请选择规则名称"
+            :disabled="isBindPlan"
+            filterable
+          >
+            <el-option
+              v-for="item in ruleNameList"
+              :key="item.id"
+              :value="item.id"
+              :label="item.name"
+            ></el-option>
+          </el-select>
+          <!-- <el-input clearable v-model.trim="where.ruleName" placeholder="请输入" /> -->
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+        <el-form-item label="盘点部门:">
+          <deptSelect
+            v-model.trim="where.executeGroupId"
+            @changeGroup="changeExecuteGroupId"
+          />
+        </el-form-item>
+        <el-form-item label="组织机构:">
+          <auth-selection v-model.trim="where.deptIds" style="width: 100%"></auth-selection>
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+        <el-form-item label="开始结束时间:">
+          <el-date-picker
+            style="width: 100%"
+            v-model="dateTime"
+            type="daterange"
+            range-separator="至"
+            start-placeholder="开始日期"
+            end-placeholder="结束日期"
+            value-format="yyyy-MM-dd HH:mm:ss"
+            :default-time="['00:00:00', '23:59:59']"
+            @change="timeChange"
+          >
+          </el-date-picker>
+        </el-form-item>
+        <div class="ele-form-actions">
+          <el-button
+            type="primary"
+            icon="el-icon-search"
+            class="ele-btn-icon"
+            @click="search"
+            size="small"
+          >
+            查询
+          </el-button>
+          <el-button
+            @click="reset"
+            icon="el-icon-refresh-left"
+            size="small"
+            type="primary"
+            >重置</el-button
+          >
+        </div>
+      </el-col>
+    </el-row>
+  </el-form>
+</template>
+
+<script>
+  import { getRule } from '@/api/ruleManagement/plan';
+  import { getTreeByGroup } from '@/api/classifyManage';
+  import { login } from '@/api/login';
+  import selectTree from '@/components/selectTree';
+  import deptSelect from '@/components/CommomSelect/dept-select.vue';
+  export default {
+    components: { deptSelect, selectTree },
+    data() {
+      // 默认表单数据
+      const defaultWhere = {
+        planCode: '',
+        planName: '',
+        ruleId: '',
+        categoryLevelId: '',
+        createTimeStart: '',
+        createTimeEnd: '',
+        executeGroupId: ''
+      };
+      return {
+        codeList: [],
+        ruleNameList: [],
+        isBindPlan: false,
+        dateTime: '',
+        codeList: [],
+        // 表单数据
+        where: { ...defaultWhere },
+        treeData: []
+      };
+    },
+    computed: {
+      // 是否开启响应式布局
+      styleResponsive() {
+        return this.$store.state.theme.styleResponsive;
+      }
+    },
+    created() {
+      this.getGoodsList();
+      this._getRuleNameList();
+    },
+    methods: {
+      timeChange(val) {
+        if (val) {
+          this.where.createTimeStart = val[0];
+          this.where.createTimeEnd = val[1];
+        } else {
+          this.where.createTimeStart = '';
+          this.where.createTimeEnd = '';
+        }
+      },
+      changeExecuteGroupId(val) {
+        if (!val) {
+          this.where.executeGroupId = '';
+        }
+      },
+      // 获取规则名列表
+      async _getRuleNameList() {
+        const res = await getRule({ status: 1, type: 4, pageNum: 1, size: -1 });
+        if (res.list) {
+          this.ruleNameList = res.list || [];
+        }
+      },
+      // 物品类型选择
+      codeListValue(val) {
+        if (val) {
+          this.where.categoryLevelId = val?.id;
+        } else {
+          this.where.categoryLevelId = '';
+        }
+      },
+      // 获取物品类型列表
+      async getGoodsList() {
+        const { data } = await getTreeByGroup({ type: 2 });
+        this.codeList = data;
+      },
+      /* 搜索 */
+      search() {
+        console.log(this.where);
+        this.$emit('search', this.where);
+      },
+      /*  重置 */
+      reset() {
+        this.dateTime = '';
+        this.where = { ...this.defaultWhere };
+        this.search();
+      }
+    }
+  };
+</script>
+<style lang="scss" scoped>
+  .ele-form-actions {
+    display: flex;
+    align-items: center;
+    justify-content: flex-end;
+  }
+</style>

+ 358 - 0
src/views/rulesManagement/warehouseInventory/components/selectType.vue

@@ -0,0 +1,358 @@
+<template>
+  <div>
+    <el-dialog
+      :title="`产品信息`"
+      append-to-body
+      :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>
+              </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-input>
+          </el-col>
+        </el-row>
+      </div>
+      <div class="flex_info">
+        <div class="flex_left">
+          <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
+              :selectable="selectable"
+              type="selection"
+              width="55"
+              align="center"
+              fixed="left"
+            >
+            </el-table-column>
+            <el-table-column
+              width="55px"
+              label="序号"
+              type="index"
+              fixed="left"
+            >
+            </el-table-column>
+            <el-table-column
+              prop="categoryId"
+              label="物品编码"
+              fixed="left"
+              :show-overflow-tooltip="true"
+            ></el-table-column>
+            <el-table-column
+              prop="categoryName"
+              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="[15, 30, 50, 100, 500]"
+              :page-size.sync="pages.size"
+              :current-page.sync="pages.pageNum"
+              @current-change="handleCurrentChange"
+              @size-change="handleSizeChange"
+            >
+            </el-pagination>
+          </div>
+        </div>
+      </div>
+      <div class="select-btn">
+        <el-button type="primary" @click="onConfirm">确定</el-button>
+        <el-button @click="closeWindows">关闭</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+  import AssetTree from './assetTree.vue';
+  import { getProductList, getBatchList } from '@/api/ruleManagement/plan';
+  import { fieldModel } from '@/api/codeManagement';
+  export default {
+    props: {
+      visibleDialog: {
+        type: Boolean,
+        default: false
+      },
+      treeIds: {
+        type: Array,
+        default: () => []
+      },
+      warehouseId: {
+        type: String,
+        default: ''
+      },
+      selectionIds: {
+        type: Array,
+        default: () => []
+      },
+      dimension: {
+        type: Number,
+        default: 1
+      },
+      loadTree: {
+        type: Boolean,
+        default: true
+      }
+    },
+    watch: {
+      tableData(val) {
+        this.doLayout();
+      },
+      visibleDialog: {
+        handler(v) {
+          if (v) {
+            this.getTreeList();
+          }
+        },
+        deep: true
+      }
+    },
+    components: { AssetTree },
+    data() {
+      return {
+        factoryList: [],
+        factoryId: '',
+        value: '',
+        treeType: '',
+        treeList: [],
+        tableData: [],
+        multipleSelection: [],
+        pages1: { classificationIdList: [] },
+        pages: {
+          pageNum: 1,
+          size: 15
+        },
+        total: 0,
+        curType: '',
+        classificationId: '',
+        memoSelection: [],
+        newColumns: [] // 动态表头
+      };
+    },
+    created() {
+      this.getFieldModel();
+    },
+    methods: {
+      selectable(row) {
+        console.log(row);
+        console.log(this.selectionIds);
+        console.log(!this.selectionIds.includes(row.categoryId));
+        return !this.selectionIds.includes(row.categoryId);
+      },
+      doLayout() {
+        let that = this;
+        this.$nextTick(() => {
+          that.$refs.multipleTable.doLayout();
+        });
+      },
+      // 获取动态表头
+      getFieldModel() {
+        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];
+        });
+      },
+      handleSearch() {
+        this.pages.pageNum = 1;
+        this.initData();
+      },
+      onConfirm() {
+        this.$emit('selectTableData', [...this.multipleSelection]);
+        this.closeWindows();
+      },
+      getTreeList() {
+        this.$nextTick(() => {
+          this.$refs.treeList.getTreeData().then((data) => {
+            this.handleNodeClick(data);
+          });
+        });
+      },
+      handleSelectionChange(val) {
+        this.multipleSelection = val;
+      },
+      handleNodeClick(data) {
+        this.classificationId = data.id;
+        this.curType = data.type;
+        this.initData();
+      },
+      closeWindows() {
+        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._getInformation();
+      },
+      async _getInformation() {
+        const params = {
+          ...this.pages,
+          keyWord: this.value,
+          warehouseId: this.warehouseId,
+          categoryLevelIds: this.classificationId
+        };
+        let res = null;
+        if (this.dimension == 1) {
+          res = await getProductList(params);
+        } else {
+          res = await getBatchList(params);
+        }
+        if (res && this.classificationId == params.categoryLevelIds) {
+          this.tableData = res.list;
+          this.total = res.count;
+        }
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  :deep(.el-checkbox__input.is-disabled .el-checkbox__inner) {
+    background-color: #eee !important;
+  }
+  .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;
+    }
+  }
+  .search_box {
+    overflow: hidden;
+  }
+  .select-btn {
+    text-align: right;
+  }
+  .right {
+    text-align: right;
+  }
+  .mt10 {
+    margin-top: 10px;
+  }
+</style>

+ 90 - 0
src/views/rulesManagement/warehouseInventory/components/tableContentData.js

@@ -0,0 +1,90 @@
+// 盘点
+export const tableContentData = [
+  {
+    name: '原料',
+    tableData: [
+      { label: '物品编码', key: 'informationCode', inKey: 'informationCode' },
+      { label: '物品名称', key: 'informationName', inKey: 'informationName' },
+      { label: '牌号', key: 'brandNum', inKey: 'brandNum' }
+    ]
+  },
+  {
+    name: '耗材',
+    tableData: [
+      { label: '物品编码', key: 'informationCode', inKey: 'informationCode' },
+      { label: '物品名称', key: 'informationName', inKey: 'informationName' },
+      { label: '规格', key: 'specification', inKey: 'specification' },
+      { label: '型号', key: 'modelType', inKey: 'modelType' }
+    ]
+  },
+  {
+    name: '物料',
+    tableData: [
+      { label: '物品编码', key: 'informationCode', inKey: 'informationCode' },
+      { label: '物品名称', key: 'informationName', inKey: 'informationName' },
+      { label: '规格', key: 'specification', inKey: 'specification' },
+      { label: '型号', key: 'modelType', inKey: 'modelType' }
+    ]
+  },
+  {
+    name: '产品',
+    tableData: [
+      { label: '物品编码', key: 'informationCode', inKey: 'informationCode' },
+      { label: '物品名称', key: 'informationName', inKey: 'informationName' },
+      { label: '牌号', key: 'brandNum', inKey: 'brandNum' },
+      { label: '型号', key: 'modelType', inKey: 'modelType' }
+    ]
+  },
+  {
+    name: '周转车',
+    tableData: [
+      { label: '物品编码', key: 'informationCode', inKey: 'informationCode' },
+      { label: '物品名称', key: 'informationName', inKey: 'informationName' },
+      { label: '规格', key: 'specification', inKey: 'specification' },
+      { label: '材质', key: 'specification', inKey: 'specification' },
+      { label: '长/宽/高', key: 'ckg', inKey: 'ckg' }
+    ]
+  },
+  {
+    name: '舟皿',
+    tableData: [
+      { label: '物品编码', key: 'informationCode', inKey: 'informationCode' },
+      { label: '物品名称', key: 'informationName', inKey: 'informationName' },
+      { label: '规格', key: 'specification', inKey: 'specification' },
+      { label: '型号', key: 'modelType', inKey: 'modelType' },
+      { label: '长/宽/高', key: 'ckg', inKey: 'ckg' }
+    ]
+  },
+  {
+    name: '生产设备',
+    tableData: [
+      { label: '物品编码', key: 'informationCode', inKey: 'informationCode' },
+      { label: '物品名称', key: 'informationName', inKey: 'informationName' },
+      { label: '规格', key: 'specification', inKey: 'specification' },
+      { label: '型号', key: 'modelType', inKey: 'modelType' }
+    ]
+  },
+  {
+    name: '模具',
+    tableData: [
+      { label: '物品编码', key: 'informationCode', inKey: 'informationCode' },
+      { label: '物品名称', key: 'informationName', inKey: 'informationName' },
+      { label: '规格', key: 'specification', inKey: 'specification' },
+      { label: '型号', key: 'modelType', inKey: 'modelType' },
+      {
+        label: '收缩系数',
+        key: 'shrinkageCoefficient',
+        inKey: 'shrinkageCoefficient'
+      }
+    ]
+  },
+  {
+    name: '备品备件',
+    tableData: [
+      { label: '物品编码', key: 'informationCode', inKey: 'informationCode' },
+      { label: '物品名称', key: 'informationName', inKey: 'informationName' },
+      { label: '规格', key: 'specification', inKey: 'specification' },
+      { label: '型号', key: 'modelType', inKey: 'modelType' }
+    ]
+  }
+];

+ 227 - 0
src/views/rulesManagement/warehouseInventory/index.vue

@@ -0,0 +1,227 @@
+<template>
+  <div class="ele-body">
+    <el-card shadow="never" v-loading="loading">
+      <inventory-search ref="inventorySearch" @search="reload">
+      </inventory-search>
+      <!-- 数据表格 -->
+      <ele-pro-table
+        ref="table"
+        :columns="columns"
+        :datasource="datasource"
+        cache-key="systemRoleTable14"
+      >
+        <!-- 表头工具栏 -->
+        <template v-slot:toolbar="{ row }">
+          <el-button
+            size="small"
+            type="primary"
+            icon="el-icon-plus"
+            class="ele-btn-icon"
+            @click="openEdit()"
+          >
+            新建
+          </el-button>
+        </template>
+        <!-- 操作列 -->
+        <template v-slot:action="{ row }">
+          <el-link
+            type="primary"
+            :underline="false"
+            icon="el-icon-edit"
+            @click="openEdit(row)"
+          >
+            修改
+          </el-link>
+          <el-link type="primary" class="ele-btn-icon" @click="goDetail(row)">
+            详情
+          </el-link>
+          <el-popconfirm
+            class="ele-action"
+            title="确定要删除此角色吗?"
+            @confirm="remove(row)"
+          >
+            <template v-slot:reference>
+              <el-link type="danger" :underline="false" icon="el-icon-delete">
+                删除
+              </el-link>
+            </template>
+          </el-popconfirm>
+        </template>
+      </ele-pro-table>
+    </el-card>
+    <!-- 新建或编辑弹窗 -->
+    <AddInventoryDialog
+      ref="addInventoryDialogRef"
+      :dialogTile="dialogTitle"
+      :id="inventoryId"
+      @refreshList="resetForm"
+      :isBindPlan="isBindPlan"
+    />
+  </div>
+</template>
+
+<script>
+  import { deleteStocktakingPlan } from '@/api/ruleManagement/plan';
+  import { getInventoryList } from '@/api/ruleManagement/plan';
+  import InventorySearch from './components/inventory-search.vue';
+  import AddInventoryDialog from './components/addInventoryDialog.vue';
+  export default {
+    components: {
+      InventorySearch,
+      AddInventoryDialog
+    },
+    data() {
+      return {
+        inventoryId: '',
+        // 表格列配置
+        columns: [
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true,
+            fixed: 'left'
+          },
+          {
+            prop: 'planCode',
+            label: '计划单号',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'planName',
+            label: '盘点名称',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'warehouseName',
+            label: '盘点仓库',
+            align: 'center',
+            showOverflowTooltip: true,
+            slot: 'enable',
+            minWidth: 110
+          },
+          {
+            prop: 'executeGroupName',
+            label: '盘点部门',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'categoryLevelName',
+            label: '资产分类',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'ruleName',
+            label: '规则名称',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'autoOrder',
+            label: '自动派单',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110,
+            formatter: (row) => {
+              return { 0: '否', 1: '是' }[row.autoOrder];
+            }
+          },
+          {
+            prop: 'enable',
+            label: '状态',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110,
+            formatter: (row) => {
+              return { 0: '失效', 1: '生效' }[row.enable];
+            }
+          },
+          {
+            prop: 'createUserName',
+            label: '创建人',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'createTime',
+            label: '创建时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110,
+            formatter: (_row, _column, cellValue) => {
+              return this.$util.toDateString(cellValue);
+            }
+          },
+          {
+            columnKey: 'action',
+            label: '操作',
+            width: 200,
+            align: 'center',
+            resizable: false,
+            slot: 'action',
+            showOverflowTooltip: true
+          }
+        ],
+        // 加载状态
+        loading: false,
+        dialogTitle: '',
+        isBindPlan: false
+      };
+    },
+    methods: {
+      // 重置
+      resetForm() {
+        this.$refs.inventorySearch.reset();
+        // this.$refs.configFormRef.resetFields();
+        // this.searchForm()
+      },
+      /* 表格数据源 */
+      datasource({ page, limit, where, order }) {
+        return getInventoryList({ pageNum: page, size: limit, ...where });
+      },
+      /* 刷新表格 */
+      reload(where) {
+        this.$refs.table.reload({ page: 1, where });
+      },
+      remove(row) {
+        deleteStocktakingPlan([row.id]).then((res) => {
+          console.log(res);
+          if (res.code == 0) {
+            this.$message.success('删除成功');
+            this.$refs.inventorySearch.reset();
+          }
+        });
+      },
+      openEdit(row) {
+        if (row) {
+          this.dialogTitle = '修改盘点计划配置';
+          this.inventoryId = row.id;
+        } else {
+          this.dialogTitle = '新增盘点计划配置';
+          this.inventoryId = '';
+        }
+        this.isBindPlan = false;
+        this.$refs.addInventoryDialogRef.dialogVisible = true;
+        // this.$store.dispatch('planRules/setAddOrUpdate', 'add')
+      },
+      goDetail(row) {
+        this.dialogTitle = '盘点计划配置详情';
+        this.inventoryId = row.id;
+        this.isBindPlan = true;
+        this.$refs.addInventoryDialogRef.dialogVisible = true;
+      }
+    }
+  };
+</script>