Просмотр исходного кода

Merge branch 'dev' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend into dev

ysy 1 год назад
Родитель
Сommit
cafda58f3a

+ 12 - 32
src/api/material/BOM.js

@@ -120,7 +120,6 @@ export async function getBomTreeList(params) {
   return Promise.reject(new Error(res.data.message));
 }
 
-
 // 查询BOM树 详情
 export async function getBomGetById(id) {
   const res = await request.get(`/main/bomCategory/getById/${id}`);
@@ -130,8 +129,6 @@ export async function getBomGetById(id) {
   return Promise.reject(new Error(res.data.message));
 }
 
-
-
 // 查询BOM 版本
 export async function versionList(params) {
   const res = await request.get(`/main/bomCategory/versionList`, { params });
@@ -141,10 +138,6 @@ export async function versionList(params) {
   return Promise.reject(new Error(res.data.message));
 }
 
-
-
- 
-
 // 新增BOM树节点
 export async function saveBomTreeList(data) {
   const res = await request.post(`/main/bomCategory/save`, data);
@@ -163,7 +156,6 @@ export async function deleteBomTreeList(data) {
   return Promise.reject(new Error(res.data.message));
 }
 
-
 // 保存BOM树节点
 export async function updateBatchBOM(data) {
   const res = await request.post(`/main/bomCategory/updateBatchBOM`, data);
@@ -173,8 +165,6 @@ export async function updateBatchBOM(data) {
   return Promise.reject(new Error(res.data.message));
 }
 
-
-
 // 获取产品BOM列表
 export async function getBomPageList(params) {
   const res = await request.get(`/main/bomCategory/page`, { params });
@@ -184,14 +174,20 @@ export async function getBomPageList(params) {
   return Promise.reject(new Error(res.data.message));
 }
 
-
-
-
-
-
 // 获取产品BOM列表
 export async function getBomPageCategoryId(params) {
-  const res = await request.get(`/main/bomCategory/pageByCategoryId`, { params });
+  const res = await request.get(`/main/bomCategory/pageByCategoryId`, {
+    params
+  });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 获取BOM明细
+export async function getBom(params) {
+  const res = await request.get(`/main/bomCategory/getBom`, { params });
   if (res.data.code == 0) {
     return res.data.data;
   }
@@ -207,7 +203,6 @@ export async function bomCategoryUpdate(data) {
   return Promise.reject(new Error(res.data.message));
 }
 
-
 // PBom转换 MBOM
 export async function convert(data) {
   const res = await request.post(`/main/bomCategory/convert`, data);
@@ -235,7 +230,6 @@ export async function convertEBOM(data) {
   return Promise.reject(new Error(res.data.message));
 }
 
-
 // EBom转换为PBom
 export async function convertEBomToPBOM(data) {
   const res = await request.post(`/main/bomCategory/convertEBomToPBOM`, data);
@@ -245,11 +239,6 @@ export async function convertEBomToPBOM(data) {
   return Promise.reject(new Error(res.data.message));
 }
 
-
-
-
-
-
 // 文档
 export async function getBomFilePageList(params) {
   const res = await request.get(`/main/bomfile/page`, { params });
@@ -275,7 +264,6 @@ export async function bomSubmit(data) {
   if (res && res.data.code == 0) {
     return res.data;
   }
-
 }
 
 // 嘉实医药提交
@@ -297,9 +285,6 @@ export async function deviceBomSubmit(data) {
   return Promise.reject(new Error(res.data.message));
 }
 
-
-
-
 // 新增工序
 export async function workingProcedureSave(data) {
   const res = await request.post(`/main/categoryparam/save`, data);
@@ -372,8 +357,6 @@ export async function workingStepSave(data) {
   return Promise.reject(new Error(res.data.message));
 }
 
-
-
 // 供应商列表
 export async function contactList(params) {
   const res = await request.get(`/eom/contact/page`, { params });
@@ -383,8 +366,6 @@ export async function contactList(params) {
   return Promise.reject(new Error(res.data.message));
 }
 
-
-
 // 检查bom  (里面有几个草稿)
 
 export async function hasNewVersion(data) {
@@ -394,4 +375,3 @@ export async function hasNewVersion(data) {
   }
   return Promise.reject(new Error(res.data.message));
 }
-

+ 6 - 10
src/views/material/BOMmanage/components/detailedList.vue

@@ -40,10 +40,7 @@
         </el-input>
       </template>
 
-
-      <template v-slot:versions="{ row }">
-       V{{ row.versions }}.0
-      </template>
+      <template v-slot:versions="{ row }"> V{{ row.versions }}.0 </template>
 
       <template v-slot:produceType="{ row }">
         <el-select
@@ -286,8 +283,8 @@
       },
 
       isTemp: {
-         type: Number,
-         default: 0
+        type: Number,
+        default: 0
       }
     },
 
@@ -295,7 +292,6 @@
       treeId: {
         handler(val) {
           this.newTreeId = val;
-       
         },
         deep: true,
         immediate: true
@@ -303,9 +299,9 @@
 
       attributeData: {
         handler(val) {
-         this.$nextTick(() => {
-          this.reload()
-         })
+          this.$nextTick(() => {
+            this.reload();
+          });
         },
         deep: true,
         immediate: true

+ 151 - 135
src/views/material/product/components/CategoryDialog.vue

@@ -1,9 +1,25 @@
 <template>
-  <ele-modal :title="title" :visible.sync="treeVisible" :before-close="handleClose" :close-on-click-modal="false"
-    :close-on-press-escape="false" append-to-body width="30%">
+  <ele-modal
+    :title="title"
+    :visible.sync="treeVisible"
+    :before-close="handleClose"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+    width="30%"
+  >
     <div class="ele-border-lighter sys-organization-list">
-      <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" v-bind="$attrs">
+      <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"
+        v-bind="$attrs"
+      >
       </el-tree>
     </div>
     <template v-slot:footer>
@@ -14,156 +30,156 @@
 </template>
 
 <script>
-import { getTreeByGroup, getTreeByPid } from '@/api/classifyManage';
-export default {
-  data() {
-    return {
-      treeVisible: false,
-      treeList: [],
-      current: null,
-      title: '选择分类',
-      pathList: [],
-
-      oneProduct: null,
-
-      treeLoading: false,
-      nodeKey: 'id',
-      defaultProps: {
-        children: 'children',
-        value: 'id',
-        label: 'name'
-      }
-    }
-  },
-
-  watch: {
-
-  },
-  methods: {
-    open() {
-      this.treeVisible = true
-      this.oneProduct = this.$route.query.oneProduct;
-      this.getTreeData()
-    },
-    handleClose() {
-      this.treeVisible = false
-      this.current = null
-    },
-    // 获取树结构数据
-    async getTreeData() {
-      try {
-        this.treeLoading = true;
-         let res 
-        if(this.oneProduct == 'false') {
-           res = await getTreeByGroup({ type: 5 });
-        } else if(this.oneProduct == 'true') {
-           res = await getTreeByPid(9)
-        } else {
-           res = await getTreeByGroup({ type: 1 });
+  import { getTreeByGroup, getTreeByPid } from '@/api/classifyManage';
+  export default {
+    data() {
+      return {
+        treeVisible: false,
+        treeList: [],
+        current: null,
+        title: '选择分类',
+        pathList: [],
+
+        oneProduct: null,
+
+        treeLoading: false,
+        nodeKey: 'id',
+        defaultProps: {
+          children: 'children',
+          value: 'id',
+          label: 'name'
         }
-
-      
-        this.treeLoading = false;
-        if (res?.code === '0') {
-          this.treeList = res.data;
-
-
-          return this.treeList;
-        }
-      } catch (error) { }
-      this.treeLoading = false;
-    },
-
-
-    handleNodeClick(data, node) {
-      this.$emit('handleNodeClick', data, node);
-      this.current = data
+      };
     },
 
-    selected() {
-      if (!this.current) {
-        return this.$message.warning(`请${this.title}`)
-      }
-      this.pathList = this.findParent([], this.current, this.treeList)
-
-
+    watch: {},
+    methods: {
+      open() {
+        this.treeVisible = true;
+        this.oneProduct = this.$route.query.oneProduct;
+        this.getTreeData();
+      },
+      handleClose() {
+        this.treeVisible = false;
+        this.current = null;
+      },
+      // 获取树结构数据
+      async getTreeData() {
+        try {
+          this.treeLoading = true;
+          let res;
+          if (this.oneProduct == 'false') {
+            res = await getTreeByGroup({ type: 5 });
+          } else if (this.oneProduct == 'true') {
+            res = await getTreeByPid(9);
+          } else {
+            res = await getTreeByGroup({ type: 1 });
+          }
 
-      let ruleCode = null
-      if (this.pathList.length == 0) {
-        ruleCode = this.current.ruleCode
+          this.treeLoading = false;
+          if (res?.code === '0') {
+            this.treeList = res.data;
 
-      } else {
-        ruleCode = this.pathList[this.pathList.length - 1] && this.pathList[this.pathList.length - 1].ruleCode
-      }
+            return this.treeList;
+          }
+        } catch (error) {}
+        this.treeLoading = false;
+      },
 
+      handleNodeClick(data, node) {
+        this.$emit('handleNodeClick', data, node);
+        this.current = data;
+      },
 
-      this.pathList.unshift(this.current)
-      const PathInfo = {
-        categoryLevelPath: '',
-        categoryLevelPathId: [],
-        rootCategoryLevelId: null
-      }
-      const pathName = []
-      this.pathList.map(item => {
-        pathName.unshift(item.name)
-        PathInfo.categoryLevelPathId.unshift(item.id)
-        PathInfo.rootCategoryLevelId = item.rootCategoryLevelId
-      })
-      PathInfo.categoryLevelPath = pathName.join('-')
-      PathInfo.categoryLevelPathId = PathInfo.categoryLevelPathId.join(',')
-
-      console.log(PathInfo)
-      this.$emit('chooseCategory', this.current, this.title, PathInfo, ruleCode)
-      this.handleClose()
-    },
+      selected() {
+        if (!this.current) {
+          return this.$message.warning(`请${this.title}`);
+        }
+        this.pathList = this.findParent([], this.current, this.treeList);
 
-    // parents:用于返回的数组,childNode:要查询的节点,treeList:json树形数据
-    findParent(parents, childNode, treeList) {
-      for (let i = 0; i < treeList.length; i++) {
-        // 父节点查询条件
-        if (treeList[i].id === childNode.parentId) {
-          // 如果找到结果,保存当前节点
-          parents.push(treeList[i])
-          // 用当前节点再去原数据查找当前节点的父节点
-          this.findParent(parents, treeList[i], this.treeList)
-          break
+        let ruleCode = null;
+        if (this.pathList.length == 0) {
+          ruleCode = this.current.ruleCode;
         } else {
-          if (treeList[i].children instanceof Array) {
-            //	没找到,遍历该节点的子节点
-            this.findParent(parents, childNode, treeList[i].children)
+          ruleCode =
+            this.pathList[this.pathList.length - 1] &&
+            this.pathList[this.pathList.length - 1].ruleCode;
+        }
+
+        this.pathList.unshift(this.current);
+        const PathInfo = {
+          categoryLevelPath: '',
+          categoryLevelPathId: [],
+          rootCategoryLevelId: null
+        };
+        const pathName = [];
+        this.pathList.map((item) => {
+          pathName.unshift(item.name);
+          PathInfo.categoryLevelPathId.unshift(item.id);
+          PathInfo.rootCategoryLevelId = item.rootCategoryLevelId;
+        });
+        PathInfo.categoryLevelPath = pathName.join('-');
+        PathInfo.categoryLevelPathId = PathInfo.categoryLevelPathId.join(',');
+
+        console.log(PathInfo);
+        this.$emit(
+          'chooseCategory',
+          this.current,
+          this.title,
+          PathInfo,
+          ruleCode
+        );
+        this.handleClose();
+      },
+
+      // parents:用于返回的数组,childNode:要查询的节点,treeList:json树形数据
+      findParent(parents, childNode, treeList) {
+        for (let i = 0; i < treeList.length; i++) {
+          // 父节点查询条件
+          if (treeList[i].id === childNode.parentId) {
+            // 如果找到结果,保存当前节点
+            parents.push(treeList[i]);
+            // 用当前节点再去原数据查找当前节点的父节点
+            this.findParent(parents, treeList[i], this.treeList);
+            break;
+          } else {
+            if (treeList[i].children instanceof Array) {
+              //	没找到,遍历该节点的子节点
+              this.findParent(parents, childNode, treeList[i].children);
+            }
           }
         }
+        return parents;
       }
-      return parents
     }
-
-  }
-}
+  };
 </script>
 
 <style lang="scss" scoped>
-.sys-organization-list {
-  height: calc(100vh - 264px);
-  box-sizing: border-box;
-  border-width: 1px;
-  border-style: solid;
-  overflow: auto;
-}
-
-.sys-organization-list :deep(.el-tree-node__content) {
-  height: 30px;
-
-  &>.el-tree-node__expand-icon {
-    margin-left: 10px;
+  .sys-organization-list {
+    height: calc(100vh - 264px);
+    box-sizing: border-box;
+    border-width: 1px;
+    border-style: solid;
+    overflow: auto;
   }
-}
 
+  .sys-organization-list :deep(.el-tree-node__content) {
+    height: 30px;
+
+    & > .el-tree-node__expand-icon {
+      margin-left: 10px;
+    }
+  }
 
-::v-deep .el-tree-node__content:hover{
-  background-color: #e6f7ff !important;
-}
+  ::v-deep .el-tree-node__content:hover {
+    background-color: #e6f7ff !important;
+  }
 
-::v-deep .el-tree--highlight-current .el-tree-node.is-current > .el-tree-node__content {
+  ::v-deep
+    .el-tree--highlight-current
+    .el-tree-node.is-current
+    > .el-tree-node__content {
     background-color: #40a9ff !important;
-}
+  }
 </style>

+ 4 - 2
src/views/material/product/components/index-data.vue

@@ -274,7 +274,8 @@
 
       rootTreeId: [Number, String],
 
-      oneProduct: Boolean
+      oneProduct: Boolean,
+      currentData: Object
     },
     data() {
       return {
@@ -501,7 +502,8 @@
             status: status,
             rootId: this.rootId,
             oneProduct: this.oneProduct,
-            t: new Date().getTime()
+            t: new Date().getTime(),
+            ...this.currentData
           }
         });
       },

+ 36 - 14
src/views/material/product/detail.vue

@@ -24,20 +24,16 @@
             </el-form-item>
           </el-col>
 
-          <el-col :span="8" v-if="ruleCode == '自定义'" key="1">
+          <el-col :span="8">
             <el-form-item label="编码" prop="code">
               <el-input
+                v-if="ruleCode == '自定义'"
                 v-model="form.code"
                 readonly
                 @click.native="openCode"
                 :disabled="status == 0"
               />
-            </el-form-item>
-          </el-col>
-
-          <el-col :span="8" v-else key="2">
-            <el-form-item label="编码" prop="code">
-              <el-input v-model="form.code" :disabled="status == 0" />
+              <el-input v-else v-model="form.code" :disabled="status == 0" />
             </el-form-item>
           </el-col>
 
@@ -54,7 +50,6 @@
           </el-col>
 
           <el-col :span="8">
-         
             <el-form-item label="生产类型" prop="produceType">
               <el-select
                 style="width: 100%"
@@ -193,7 +188,7 @@
             <el-form-item :label="f.label">
               <template>
                 <div class="form-line">
-                  <component              
+                  <component
                     :is="f.tagType"
                     v-model="form.extField[f.prop]"
                     :disabled="f.extAttribute?.disabled"
@@ -391,7 +386,7 @@
           } else {
             this.form = {
               categoryLevelGroupName: '',
-              categoryLevelName: '',
+              // categoryLevelName: '',
               isConsumable: 1,
 
               extField: {}
@@ -422,8 +417,36 @@
       }
     },
     async created() {
+      this.$set(
+        this.form,
+        'categoryLevelId',
+        this.$route.query.categoryLevelId
+      );
+      this.$set(
+        this.form,
+        'categoryLevelName',
+        this.$route.query.categoryLevelName
+      );
+      this.$set(
+        this.form,
+        'categoryLevelPath',
+        this.$route.query.categoryLevelPath
+      );
+      this.$set(
+        this.form,
+        'categoryLevelPathId',
+        this.$route.query.categoryLevelPathId
+      );
+      this.ruleCode = this.$route.query.ruleCode;
+
+      if (this.ruleCode && this.ruleCode != '自定义' && this.status != 0) {
+        const code = await getCode(this.ruleCode);
+        this.$set(this.form, 'code', code);
+      }
+
       this.getFieldModel();
       this.status = this.$route.query.status;
+
       // if (this.$route.query.id) {
       //   this._getDetails();
       // }
@@ -440,7 +463,6 @@
         this.form = {
           ...info.category
         };
-   
 
         this.categoryLevelPathId = info.category.categoryLevelPathIdParent;
         this.judgeSet(info);
@@ -553,7 +575,6 @@
             label: item[values[0]]
           };
         });
- 
       },
 
       openCategory() {
@@ -579,7 +600,7 @@
       submit() {
         this.$refs.manageForm.validate(async (valid) => {
           let productionValid = await this.$refs.productionRefs.getFormValid();
-          console.log(productionValid);
+
           if (!valid || !productionValid) {
             return false;
           }
@@ -697,7 +718,8 @@
               }
             );
           }
-
+          console.log(data, 'datadatadatadatadata');
+          return;
           addMaterial(data)
             .then((msg) => {
               this.loading = false;

+ 194 - 141
src/views/material/product/index.vue

@@ -1,11 +1,21 @@
 <template>
   <div class="ele-body">
     <el-card shadow="never">
-      <ele-split-layout width="300px" allow-collapse :right-style="{ overflow: 'hidden' }">
+      <ele-split-layout
+        width="300px"
+        allow-collapse
+        :right-style="{ overflow: 'hidden' }"
+      >
         <div class="ele-border-lighter sys-organization-list">
-          <el-tree :data="treeList" :props="defaultProps" ref="treeRef"
-            :default-expanded-keys="current && current.id ? [current.id] : []" :highlight-current="true" node-key="id"
-            @node-click="handleNodeClick"></el-tree>
+          <el-tree
+            :data="treeList"
+            :props="defaultProps"
+            ref="treeRef"
+            :default-expanded-keys="current && current.id ? [current.id] : []"
+            :highlight-current="true"
+            node-key="id"
+            @node-click="handleNodeClick"
+          ></el-tree>
         </div>
 
         <template v-slot:content>
@@ -66,7 +76,16 @@
 
             <IndexSearch @search="reload" />
 
-            <IndexData ref="listData" v-if="current" :current-id="current.id" :data="current" :rootTreeId="rootTreeId" :rootId="rootId" :oneProduct="false" >
+            <IndexData
+              ref="listData"
+              v-if="current"
+              :current-id="current.id"
+              :data="current"
+              :rootTreeId="rootTreeId"
+              :rootId="rootId"
+              :oneProduct="false"
+              :currentData="currentData"
+            >
             </IndexData>
           </div>
         </template>
@@ -75,167 +94,201 @@
   </div>
 </template>
 <script>
-import IndexData from './components/index-data.vue';
-import IndexSearch from './components/index-search.vue';
-
-import dictMixins from '@/mixins/dictMixins';
-import { getTreeByGroup } from '@/api/classifyManage';
-
-import { getInfoById } from '@/api/classifyManage';
-
-export default {
-  components: {
-    IndexData,
-    IndexSearch
-  },
-  mixins: [dictMixins],
-  data() {
-    return {
-      loading: false,
-      current: {},
-      curNode: {},
-      treeList: [],
-      treeLoading: false,
-      formData: {},
-       rootTreeId: null,
-      defaultProps: {
-        children: 'children',
-        label: 'name'
-      }
-    };
-  },
+  import IndexData from './components/index-data.vue';
+  import IndexSearch from './components/index-search.vue';
 
-  computed: {
-    // 是否开启响应式布局
-    styleResponsive() {
-      return this.$store.state.theme.styleResponsive;
-    },
+  import dictMixins from '@/mixins/dictMixins';
+  import { getTreeByGroup } from '@/api/classifyManage';
+
+  import { getInfoById } from '@/api/classifyManage';
 
-    rootId() {
-      return this.$route.query.id;
+  export default {
+    components: {
+      IndexData,
+      IndexSearch
     },
+    mixins: [dictMixins],
+    data() {
+      return {
+        loading: false,
+        current: {},
+        curNode: {},
+        treeList: [],
+        treeLoading: false,
+        formData: {},
+        rootTreeId: null,
+        defaultProps: {
+          children: 'children',
+          label: 'name'
+        },
+        currentData: {}
+      };
+    },
+
+    computed: {
+      // 是否开启响应式布局
+      styleResponsive() {
+        return this.$store.state.theme.styleResponsive;
+      },
 
-    fullName() {
-      let str = '';
-      let codeStr = '';
-      let node = this.curNode;
-      while (node?.data?.name) {
-        str = node.data.name + '-' + str;
-        codeStr = node.data.code + '-' + codeStr;
-        node = node?.parent;
+      rootId() {
+        return this.$route.query.id;
+      },
+
+      fullName() {
+        let str = '';
+        let codeStr = '';
+        let node = this.curNode;
+        while (node?.data?.name) {
+          str = node.data.name + '-' + str;
+          codeStr = node.data.code + '-' + codeStr;
+          node = node?.parent;
+        }
+
+        return str.substring(str, str.length - 1);
+        // return (
+        //   str.substring(str, str.length - 1) +
+        //   `(${codeStr.substring(str, str.length - 1)})`
+        // );
       }
+    },
+    created() {
+      this.getTreeData();
+    },
+    methods: {
+      async getTreeData() {
+        try {
+          this.treeLoading = true;
 
-      return str.substring(str, str.length - 1);
-      // return (
-      //   str.substring(str, str.length - 1) +
-      //   `(${codeStr.substring(str, str.length - 1)})`
-      // );
-    }
-  },
-  created() {
-    this.getTreeData();
-  },
-  methods: {
-    async getTreeData() {
-      try {
-        this.treeLoading = true;
-
-        const res = await getTreeByGroup({ type: 5 });
+          const res = await getTreeByGroup({ type: 5 });
+          this.treeLoading = false;
+          if (res?.code === '0') {
+            this.treeList = res.data;
+
+            this.$nextTick(() => {
+              // 默认高亮第一级树节点
+              if (this.treeList[0]) {
+                this.rootTreeId = this.treeList[0].id;
+                this.getDetail(this.treeList[0].id);
+              }
+            });
+            return this.treeList;
+          }
+        } catch (error) {}
         this.treeLoading = false;
-        if (res?.code === '0') {
-          this.treeList = res.data;
+      },
 
+      async getDetail(id) {
+        this.loading = true;
+        const res = await getInfoById(id);
+        this.loading = false;
+        if (res.code == '0') {
+          this.current = res.data;
           this.$nextTick(() => {
-            // 默认高亮第一级树节点
-            if (this.treeList[0]) {
-              this.rootTreeId = this.treeList[0].id
-              this.getDetail(this.treeList[0].id);
-            }
+            this.$refs.treeRef.setCurrentKey(this.current.id);
           });
-          return this.treeList;
         }
-      } catch (error) { }
-      this.treeLoading = false;
-    },
+      },
 
-    async getDetail(id) {
-      this.loading = true;
-      const res = await getInfoById(id);
-      this.loading = false;
-      if (res.code == '0') {
-        this.current = res.data;
-        this.$nextTick(() => {
-          this.$refs.treeRef.setCurrentKey(this.current.id);
-        });
-      }
-    },
+      handleNodeClick(data, node) {
+        this.curNode = node;
+        this.pathList = this.findParent([], data, this.treeList);
+        this.rootTreeId = null;
+        if (this.pathList.length == 0) {
+          this.rootTreeId = data.id;
+        } else {
+          this.rootTreeId =
+            this.pathList[this.pathList.length - 1] &&
+            this.pathList[this.pathList.length - 1].id;
+        }
 
-    handleNodeClick(data, node) {
-      this.curNode = node;
-      this.pathList = this.findParent([], data, this.treeList)
-        this.rootTreeId = null
-      if (this.pathList.length == 0) {
-        this.rootTreeId  = data.id
+        let ruleCode = null;
+        if (this.pathList.length == 0) {
+          ruleCode = data.ruleCode;
+        } else {
+          ruleCode =
+            this.pathList[this.pathList.length - 1] &&
+            this.pathList[this.pathList.length - 1].ruleCode;
+        }
 
-      } else {
-        this.rootTreeId  = this.pathList[this.pathList.length - 1] && this.pathList[this.pathList.length - 1].id
-      }
+        this.pathList.unshift(data);
+        const PathInfo = {
+          categoryLevelPath: '',
+          categoryLevelPathId: [],
+          // rootCategoryLevelId: null,
+          categoryLevelId: '',
+          categoryLevelName: '',
+          ruleCode: ''
+        };
+        const pathName = [];
+        this.pathList.map((item) => {
+          pathName.unshift(item.name);
+          PathInfo.categoryLevelPathId.unshift(item.id);
+          // PathInfo.rootCategoryLevelId = item.rootCategoryLevelId;
+        });
+        PathInfo.categoryLevelPath = pathName.join('-');
+        PathInfo.categoryLevelPathId = PathInfo.categoryLevelPathId.join(',');
+        PathInfo.categoryLevelId = data.id;
+        PathInfo.categoryLevelName = data.name;
+        PathInfo.ruleCode = ruleCode;
 
+        console.log(PathInfo, '点击产品分类');
+        this.currentData = PathInfo;
 
-      this.getDetail(data.id);
-    },
+        this.getDetail(data.id);
+      },
 
-    /* 刷新表格 */
-    reload(where) {
-      this.$refs.listData.reload(where);
-    },
+      /* 刷新表格 */
+      reload(where) {
+        this.$refs.listData.reload(where);
+      },
 
-    // parents:用于返回的数组,childNode:要查询的节点,treeList:json树形数据
-    findParent(parents, childNode, treeList) {
-      for (let i = 0; i < treeList.length; i++) {
-        // 父节点查询条件
-        if (treeList[i].id === childNode.parentId) {
-          // 如果找到结果,保存当前节点
-          parents.push(treeList[i])
-          // 用当前节点再去原数据查找当前节点的父节点
-          this.findParent(parents, treeList[i], this.treeList)
-          break
-        } else {
-          if (treeList[i].children instanceof Array) {
-            //	没找到,遍历该节点的子节点
-            this.findParent(parents, childNode, treeList[i].children)
+      // parents:用于返回的数组,childNode:要查询的节点,treeList:json树形数据
+      findParent(parents, childNode, treeList) {
+        for (let i = 0; i < treeList.length; i++) {
+          // 父节点查询条件
+          if (treeList[i].id === childNode.parentId) {
+            // 如果找到结果,保存当前节点
+            parents.push(treeList[i]);
+            // 用当前节点再去原数据查找当前节点的父节点
+            this.findParent(parents, treeList[i], this.treeList);
+            break;
+          } else {
+            if (treeList[i].children instanceof Array) {
+              //	没找到,遍历该节点的子节点
+              this.findParent(parents, childNode, treeList[i].children);
+            }
           }
         }
+        return parents;
       }
-      return parents
     }
-  }
-};
+  };
 </script>
 <style lang="scss" scoped>
-.sys-organization-list {
-  height: calc(100vh - 165px);
-  box-sizing: border-box;
-  border-width: 1px;
-  border-style: solid;
-  overflow: auto;
-}
-
-.sys-organization-list :deep(.el-tree-node__content) {
-  height: 30px;
-
-  &>.el-tree-node__expand-icon {
-    margin-left: 10px;
+  .sys-organization-list {
+    height: calc(100vh - 165px);
+    box-sizing: border-box;
+    border-width: 1px;
+    border-style: solid;
+    overflow: auto;
+  }
+
+  .sys-organization-list :deep(.el-tree-node__content) {
+    height: 30px;
+
+    & > .el-tree-node__expand-icon {
+      margin-left: 10px;
+    }
   }
-}
 
-.form-content {
-  height: 50px;
-  border: 1px solid;
-  box-sizing: border-box;
-}
+  .form-content {
+    height: 50px;
+    border: 1px solid;
+    box-sizing: border-box;
+  }
 
-.form-wrapper {
-  padding: 12px 24px;
-}
+  .form-wrapper {
+    padding: 12px 24px;
+  }
 </style>

+ 164 - 112
src/views/material/product/oneProduct.vue

@@ -1,88 +1,107 @@
 <template>
-    <div class="ele-body">
-      <el-card shadow="never">
-        <ele-split-layout width="300px" allow-collapse :right-style="{ overflow: 'hidden' }">
-          <div class="ele-border-lighter sys-organization-list">
-            <el-tree :data="treeList" :props="defaultProps" ref="treeRef"
-              :default-expanded-keys="current && current.id ? [current.id] : []" :highlight-current="true" node-key="id"
-              @node-click="handleNodeClick"></el-tree>
-          </div>
-  
-          <template v-slot:content>
-            <div class="ele-border-lighter form-content" v-loading="loading">
-              <div class="form-wrapper">
-                <el-form size="mini" label-width="100px" class="ele-form-detail">
-                  <el-row :gutter="15" v-if="current.parentId == 0">
-                    <el-col v-bind="styleResponsive ? { sm: 6 } : { span: 6 }">
-                      <el-form-item label="类型编码:">
-                        <div class="ele-text-secondary">
-                          {{ current.code }}
-                        </div>
-                      </el-form-item>
-                    </el-col>
-                    <el-col v-bind="styleResponsive ? { sm: 6 } : { span: 6 }">
-                      <el-form-item label="类型名称:">
-                        <div class="ele-text-secondary">
-                          {{ current.name }}
-                        </div>
-                      </el-form-item>
-                    </el-col>
-  
-                    <el-col v-bind="styleResponsive ? { sm: 12 } : { span: 12 }">
-                      <el-form-item label="描述:">
-                        <div class="ele-text-secondary">
-                          {{ current.remark }}
-                        </div>
-                      </el-form-item>
-                    </el-col>
-                  </el-row>
-                  <el-row :gutter="15" v-else>
-                    <el-col v-bind="styleResponsive ? { sm: 6 } : { span: 6 }">
-                      <el-form-item label="节点编码:">
-                        <div class="ele-text-secondary">
-                          {{ current.code }}
-                        </div>
-                      </el-form-item>
-                    </el-col>
-  
-                    <el-col v-bind="styleResponsive ? { sm: 6 } : { span: 6 }">
-                      <el-form-item label="节点名称:">
-                        <div class="ele-text-secondary">
-                          {{ current.name }}
-                        </div>
-                      </el-form-item>
-                    </el-col>
-  
-                    <el-col v-bind="styleResponsive ? { sm: 12 } : { span: 12 }">
-                      <el-form-item label="层级全览:">
-                        <div class="ele-text-secondary">
-                          {{ fullName }}
-                        </div>
-                      </el-form-item>
-                    </el-col>
-                  </el-row>
-                </el-form>
-              </div>
-  
-              <IndexSearch @search="reload" />
-  
-              <IndexData ref="listData" v-if="current" :current-id="current.id" :data="current" :rootTreeId="rootTreeId" :rootId="rootId" :oneProduct="true">
-              </IndexData>
+  <div class="ele-body">
+    <el-card shadow="never">
+      <ele-split-layout
+        width="300px"
+        allow-collapse
+        :right-style="{ overflow: 'hidden' }"
+      >
+        <div class="ele-border-lighter sys-organization-list">
+          <el-tree
+            :data="treeList"
+            :props="defaultProps"
+            ref="treeRef"
+            :default-expanded-keys="current && current.id ? [current.id] : []"
+            :highlight-current="true"
+            node-key="id"
+            @node-click="handleNodeClick"
+          ></el-tree>
+        </div>
+
+        <template v-slot:content>
+          <div class="ele-border-lighter form-content" v-loading="loading">
+            <div class="form-wrapper">
+              <el-form size="mini" label-width="100px" class="ele-form-detail">
+                <el-row :gutter="15" v-if="current.parentId == 0">
+                  <el-col v-bind="styleResponsive ? { sm: 6 } : { span: 6 }">
+                    <el-form-item label="类型编码:">
+                      <div class="ele-text-secondary">
+                        {{ current.code }}
+                      </div>
+                    </el-form-item>
+                  </el-col>
+                  <el-col v-bind="styleResponsive ? { sm: 6 } : { span: 6 }">
+                    <el-form-item label="类型名称:">
+                      <div class="ele-text-secondary">
+                        {{ current.name }}
+                      </div>
+                    </el-form-item>
+                  </el-col>
+
+                  <el-col v-bind="styleResponsive ? { sm: 12 } : { span: 12 }">
+                    <el-form-item label="描述:">
+                      <div class="ele-text-secondary">
+                        {{ current.remark }}
+                      </div>
+                    </el-form-item>
+                  </el-col>
+                </el-row>
+                <el-row :gutter="15" v-else>
+                  <el-col v-bind="styleResponsive ? { sm: 6 } : { span: 6 }">
+                    <el-form-item label="节点编码:">
+                      <div class="ele-text-secondary">
+                        {{ current.code }}
+                      </div>
+                    </el-form-item>
+                  </el-col>
+
+                  <el-col v-bind="styleResponsive ? { sm: 6 } : { span: 6 }">
+                    <el-form-item label="节点名称:">
+                      <div class="ele-text-secondary">
+                        {{ current.name }}
+                      </div>
+                    </el-form-item>
+                  </el-col>
+
+                  <el-col v-bind="styleResponsive ? { sm: 12 } : { span: 12 }">
+                    <el-form-item label="层级全览:">
+                      <div class="ele-text-secondary">
+                        {{ fullName }}
+                      </div>
+                    </el-form-item>
+                  </el-col>
+                </el-row>
+              </el-form>
             </div>
-          </template>
-        </ele-split-layout>
-      </el-card>
-    </div>
-  </template>
-  <script>
+
+            <IndexSearch @search="reload" />
+
+            <IndexData
+              ref="listData"
+              v-if="current"
+              :current-id="current.id"
+              :data="current"
+              :rootTreeId="rootTreeId"
+              :currentData="currentData"
+              :rootId="rootId"
+              :oneProduct="true"
+            >
+            </IndexData>
+          </div>
+        </template>
+      </ele-split-layout>
+    </el-card>
+  </div>
+</template>
+<script>
   import IndexData from './components/index-data.vue';
   import IndexSearch from './components/index-search.vue';
-  
+
   import dictMixins from '@/mixins/dictMixins';
   import { getTreeByPid } from '@/api/classifyManage';
-  
+
   import { getInfoById } from '@/api/classifyManage';
-  
+
   export default {
     components: {
       IndexData,
@@ -94,27 +113,28 @@
         loading: false,
         current: {},
         curNode: {},
+        currentData: {},
         treeList: [],
         treeLoading: false,
         formData: {},
-         rootTreeId: null,
+        rootTreeId: null,
         defaultProps: {
           children: 'children',
           label: 'name'
         }
       };
     },
-  
+
     computed: {
       // 是否开启响应式布局
       styleResponsive() {
         return this.$store.state.theme.styleResponsive;
       },
-  
+
       rootId() {
         return this.$route.query.id;
       },
-  
+
       fullName() {
         let str = '';
         let codeStr = '';
@@ -124,7 +144,7 @@
           codeStr = node.data.code + '-' + codeStr;
           node = node?.parent;
         }
-  
+
         return str.substring(str, str.length - 1);
       }
     },
@@ -135,25 +155,25 @@
       async getTreeData() {
         try {
           this.treeLoading = true;
-  
+
           const res = await getTreeByPid(9);
           this.treeLoading = false;
           if (res?.code === '0') {
             this.treeList = res.data;
-  
+
             this.$nextTick(() => {
               // 默认高亮第一级树节点
               if (this.treeList[0]) {
-                this.rootTreeId = this.treeList[0].id
+                this.rootTreeId = this.treeList[0].id;
                 this.getDetail(this.treeList[0].id);
               }
             });
             return this.treeList;
           }
-        } catch (error) { }
+        } catch (error) {}
         this.treeLoading = false;
       },
-  
+
       async getDetail(id) {
         this.loading = true;
         const res = await getInfoById(id);
@@ -165,50 +185,83 @@
           });
         }
       },
-  
+
       handleNodeClick(data, node) {
         this.curNode = node;
-        this.pathList = this.findParent([], data, this.treeList)
-          this.rootTreeId = null
+        this.pathList = this.findParent([], data, this.treeList);
+        this.rootTreeId = null;
+        if (this.pathList.length == 0) {
+          this.rootTreeId = data.id;
+        } else {
+          this.rootTreeId =
+            this.pathList[this.pathList.length - 1] &&
+            this.pathList[this.pathList.length - 1].id;
+        }
+
+        let ruleCode = null;
         if (this.pathList.length == 0) {
-          this.rootTreeId  = data.id
-  
+          ruleCode = data.ruleCode;
         } else {
-          this.rootTreeId  = this.pathList[this.pathList.length - 1] && this.pathList[this.pathList.length - 1].id
+          ruleCode =
+            this.pathList[this.pathList.length - 1] &&
+            this.pathList[this.pathList.length - 1].ruleCode;
         }
-  
-  
+
+        this.pathList.unshift(data);
+        const PathInfo = {
+          categoryLevelPath: '',
+          categoryLevelPathId: [],
+          // rootCategoryLevelId: null,
+          categoryLevelId: '',
+          categoryLevelName: '',
+          ruleCode: ''
+        };
+        const pathName = [];
+        this.pathList.map((item) => {
+          pathName.unshift(item.name);
+          PathInfo.categoryLevelPathId.unshift(item.id);
+          // PathInfo.rootCategoryLevelId = item.rootCategoryLevelId;
+        });
+        PathInfo.categoryLevelPath = pathName.join('-');
+        PathInfo.categoryLevelPathId = PathInfo.categoryLevelPathId.join(',');
+        PathInfo.categoryLevelId = data.id;
+        PathInfo.categoryLevelName = data.name;
+        PathInfo.ruleCode = ruleCode;
+
+        console.log(PathInfo, '点击产品分类');
+        this.currentData = PathInfo;
+
         this.getDetail(data.id);
       },
-  
+
       /* 刷新表格 */
       reload(where) {
         this.$refs.listData.reload(where);
       },
-  
+
       // parents:用于返回的数组,childNode:要查询的节点,treeList:json树形数据
       findParent(parents, childNode, treeList) {
         for (let i = 0; i < treeList.length; i++) {
           // 父节点查询条件
           if (treeList[i].id === childNode.parentId) {
             // 如果找到结果,保存当前节点
-            parents.push(treeList[i])
+            parents.push(treeList[i]);
             // 用当前节点再去原数据查找当前节点的父节点
-            this.findParent(parents, treeList[i], this.treeList)
-            break
+            this.findParent(parents, treeList[i], this.treeList);
+            break;
           } else {
             if (treeList[i].children instanceof Array) {
               //	没找到,遍历该节点的子节点
-              this.findParent(parents, childNode, treeList[i].children)
+              this.findParent(parents, childNode, treeList[i].children);
             }
           }
         }
-        return parents
+        return parents;
       }
     }
   };
-  </script>
-  <style lang="scss" scoped>
+</script>
+<style lang="scss" scoped>
   .sys-organization-list {
     height: calc(100vh - 165px);
     box-sizing: border-box;
@@ -216,23 +269,22 @@
     border-style: solid;
     overflow: auto;
   }
-  
+
   .sys-organization-list :deep(.el-tree-node__content) {
     height: 30px;
-  
-    &>.el-tree-node__expand-icon {
+
+    & > .el-tree-node__expand-icon {
       margin-left: 10px;
     }
   }
-  
+
   .form-content {
     height: 50px;
     border: 1px solid;
     box-sizing: border-box;
   }
-  
+
   .form-wrapper {
     padding: 12px 24px;
   }
-  </style>
-  
+</style>

+ 103 - 50
src/views/rulesManagement/matterRules/components/ProductModal.vue

@@ -1,63 +1,86 @@
 <template>
-  <el-dialog
-    :title="title"
-    :visible.sync="visible"
-    :before-close="handleClose"
-    class="productModal_dialog"
-    :close-on-click-modal="false"
-    :close-on-press-escape="false"
-    append-to-body
-    width="70%"
-  >
-    <el-card shadow="never">
-      <ProductSearch @search="reload" ref="searchRef" />
+  <div>
+    <el-dialog
+      :title="title"
+      :visible.sync="visible"
+      :before-close="handleClose"
+      class="productModal_dialog"
+      :close-on-click-modal="false"
+      :close-on-press-escape="false"
+      append-to-body
+      width="70%"
+    >
+      <el-card shadow="never">
+        <ProductSearch @search="reload" ref="searchRef" />
 
-      <ele-split-layout
-        width="244px"
-        allow-collapse
-        :right-style="{ overflow: 'hidden' }"
-      >
-        <div class="ele-border-lighter split-layout-right-content">
-          <el-tree
-            :data="treeList"
-            :props="defaultProps"
-            ref="treeRef"
-            :default-expanded-keys="categoryId ? [categoryId] : []"
-            :highlight-current="true"
-            node-key="id"
-            @node-click="handleNodeClick"
-          ></el-tree>
-        </div>
+        <ele-split-layout
+          width="244px"
+          allow-collapse
+          :right-style="{ overflow: 'hidden' }"
+        >
+          <div class="ele-border-lighter split-layout-right-content">
+            <el-tree
+              :data="treeList"
+              :props="defaultProps"
+              ref="treeRef"
+              :default-expanded-keys="categoryId ? [categoryId] : []"
+              :highlight-current="true"
+              node-key="id"
+              @node-click="handleNodeClick"
+            ></el-tree>
+          </div>
 
-        <!-- 数据表格 -->
-        <template v-slot:content>
-          <ele-pro-table
-            style="min-height: 400px"
-            ref="table"
-            :columns="columns"
-            :datasource="datasource"
-            :selection.sync="selection"
-            row-key="id"
-          >
-          </ele-pro-table>
-        </template>
-      </ele-split-layout>
-    </el-card>
+          <!-- 数据表格 -->
+          <template v-slot:content>
+            <ele-pro-table
+              style="min-height: 400px"
+              ref="table"
+              :columns="columns"
+              :datasource="datasource"
+              :selection.sync="selection"
+              row-key="id"
+            >
+              <template v-slot:action="{ row }">
+                <el-link
+                  type="primary"
+                  :underline="false"
+                  v-if="receiveValue == '零部件'"
+                  @click="openBOMForm(row)"
+                  >BOM</el-link
+                >
+              </template>
+            </ele-pro-table>
+          </template>
+        </ele-split-layout>
+      </el-card>
 
-    <div class="rx-sc">
-      <el-button type="primary" size="small" @click="selected">选择</el-button>
-      <el-button size="small" @click="handleClose">关闭</el-button>
-    </div>
-  </el-dialog>
+      <div class="rx-sc">
+        <el-button type="primary" size="small" @click="selected"
+          >选择</el-button
+        >
+        <el-button size="small" @click="handleClose">关闭</el-button>
+      </div>
+    </el-dialog>
+
+    <bomDetail
+      v-if="bomDetailDialogFlag"
+      :bomDetailDialogFlag.sync="bomDetailDialogFlag"
+      ref="bomDialogRef"
+      :rowDataBom="rowDataBom"
+      @chooseRadio="chooseRadio"
+    ></bomDetail>
+  </div>
 </template>
 
 <script>
   import ProductSearch from './product-search.vue';
   import { getTreeByGroup } from '@/api/classifyManage';
   import { getList } from '@/api/classifyManage/itemInformation.js';
+  import bomDetail from '../components/bomDetailList.vue';
   export default {
     components: {
-      ProductSearch
+      ProductSearch,
+      bomDetail
     },
     data() {
       return {
@@ -131,6 +154,11 @@
           {
             label: '数量',
             prop: 'count'
+          },
+          {
+            label: '操作',
+            columnKey: 'action',
+            slot: 'action'
           }
         ],
 
@@ -138,7 +166,10 @@
         selection: [],
 
         processData: [],
-        current: null
+        current: null,
+        receiveValue: '',
+        receiveIndex: '',
+        bomDetailDialogFlag: false
       };
     },
 
@@ -154,9 +185,26 @@
         });
         return res;
       },
+      openBOMForm(row) {
+        this.bomDetailDialogFlag = true;
+        row.fIndex = this.receiveIndex;
+        this.rowDataBom = row;
+        console.log(this.rowDataBom, 'rowDataBom');
+        /*      this.$nextTick(() => {
+          this.$refs.bomDialogRef.open3(row);
+        }); */
+      },
+      open2(rowData, index, name) {
+        console.log(rowData, index, name, '222222222222');
+        this.processData = [];
+        this.visible = true;
+        this.getTreeData();
+        this.receiveIndex = index;
+        this.receiveValue = name;
+      },
 
       open(item) {
-        this.processData = item || [];
+        this.processData = Array.isArray(item) ? item : [];
         this.visible = true;
 
         this.getTreeData();
@@ -218,6 +266,11 @@
 
         this.$emit('chooseModal', _arr);
         this.handleClose();
+      },
+      chooseRadio(row) {
+        console.log(row, '勾选');
+        this.visible = false;
+        this.$emit('chooseRadio', row);
       }
     }
   };

+ 394 - 0
src/views/rulesManagement/matterRules/components/bomDetailList.vue

@@ -0,0 +1,394 @@
+<template>
+  <div>
+    <el-dialog
+      title="选择明细"
+      custom-class="ele-dialog-form long-dialog-form"
+      :visible.sync="bomDetailDialogFlag"
+      :before-close="handleClose"
+      :close-on-click-modal="false"
+      :close-on-press-escape="false"
+      :modal="false"
+      width="55%"
+    >
+      <el-card shadow="never">
+        <BOMSearch @search="reload" :statusOpt="statusOpt" />
+        <!-- 数据表格 -->
+        <ele-pro-table
+          ref="table"
+          :needPage="false"
+          :columns="columns"
+          :datasource="bomList"
+          class="dict-table"
+          tool-class="ele-toolbar-actions"
+          :selection.sync="selection"
+          row-key="id"
+        >
+          <template v-slot:toolbar>
+            <div class="toolbar_box"> </div>
+          </template>
+
+          <template v-slot:dosage="{ row }">
+            <el-input
+              v-model="row.dosage"
+              placeholder="请输入"
+              size="mini"
+              style="width: 68px"
+            >
+            </el-input>
+          </template>
+
+          <template v-slot:versions="{ row }"> V{{ row.versions }}.0 </template>
+
+          <template v-slot:produceType="{ row }">
+            <el-select
+              v-model="row.produceType"
+              filterable
+              multiple
+              collapse-tags
+              class="ele-block"
+              size="mini"
+            >
+              <el-option
+                v-for="item in dictList"
+                :key="item.value"
+                :value="item.value"
+                :label="item.label"
+              ></el-option>
+            </el-select>
+          </template>
+
+          <template v-slot:materielDesignation="{ row }">
+            <el-input
+              v-model="row.materielDesignation"
+              placeholder="请输入物料代号"
+              size="mini"
+              style="width: 120px"
+            >
+            </el-input>
+          </template>
+
+          <template v-slot:supplierId="{ row }">
+            <el-select
+              v-model="row.supplierId"
+              size="mini"
+              clearable
+              class="ele-block"
+              filterable
+              placeholder="请选择供应商"
+            >
+              <el-option
+                v-for="(item, index) in gysList"
+                :key="item.id + index"
+                :value="item.id"
+                :label="item.name"
+              ></el-option>
+            </el-select>
+          </template>
+
+          <template v-slot:factories="{ row }">
+            <el-input
+              v-model="row.factories"
+              placeholder="请输入生产厂家"
+              size="mini"
+              style="width: 120px"
+            >
+            </el-input>
+          </template>
+
+          <!-- 表头工具栏 -->
+        </ele-pro-table>
+      </el-card>
+
+      <div class="btns" slot="footer">
+        <el-button type="primary" size="small" @click="selected"
+          >选择</el-button
+        >
+        <el-button size="small" @click="handleClose">关闭</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+  import BOMSearch from '@/views/material/BOMmanage/components/BOM-search.vue';
+  import {
+    getBom,
+    contactList,
+    deleteBomTreeList,
+    updateBatchBOM
+  } from '@/api/material/BOM';
+  import { getByCode } from '@/api/system/dictionary-data';
+
+  export default {
+    name: 'bomDetailList',
+    components: {
+      BOMSearch
+    },
+    props: {
+      projectTeamDialogFlag: {
+        default: false,
+        type: Boolean
+      },
+      bomDetailDialogFlag: {
+        type: Boolean,
+        default: false
+      },
+      rowDataBom: {
+        type: Object,
+        default: () => {}
+      }
+    },
+    data() {
+      return {
+        currentIndex: null,
+        columns: [
+          {
+            columnKey: 'selection',
+            type: 'selection',
+            width: 45,
+            align: 'center',
+            reserveSelection: true,
+            fixed: 'left'
+          },
+          {
+            label: '序号',
+            columnKey: 'index',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'code',
+            label: '编码',
+            showOverflowTooltip: true,
+            width: 120
+          },
+          {
+            prop: 'name',
+            label: '名称',
+            width: 150
+          },
+
+          {
+            prop: 'level',
+            label: '层级'
+          },
+
+          {
+            prop: 'brandNum',
+            label: '牌号'
+          },
+
+          {
+            prop: 'modelType',
+            label: '型号',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'specification',
+            label: '规格',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+
+          {
+            prop: 'dosage',
+            slot: 'dosage',
+            label: '用量',
+            width: 100
+          },
+
+          {
+            prop: 'measuringUnit',
+            label: '计量单位',
+            showOverflowTooltip: true
+          },
+
+          {
+            prop: 'produceType',
+            slot: 'produceType',
+            label: '生产类型',
+            width: 160
+          },
+
+          {
+            prop: 'materielDesignation',
+            slot: 'materielDesignation',
+            label: '物料代号',
+            width: 150
+          },
+
+          {
+            prop: 'supplierId',
+            slot: 'supplierId',
+            label: '供应商',
+            width: 150
+          },
+
+          {
+            prop: 'factories',
+            slot: 'factories',
+            label: '生产厂家',
+            width: 180
+          },
+
+          {
+            prop: 'versions',
+            slot: 'versions',
+            label: '版本'
+          },
+
+          {
+            prop: 'status ',
+            label: '状态',
+            formatter: (row) => {
+              return this.statusOpt[+row.status];
+            }
+          },
+
+          {
+            prop: 'createName',
+            label: '创建人',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'createTime',
+            label: '创建日期',
+            width: 160
+          }
+        ],
+        statusOpt: {
+          '': '全部',
+          0: '草稿',
+          1: '已发布'
+        },
+
+        gysList: [],
+
+        newTreeId: null,
+
+        dictList: [],
+        radio: null,
+        selection: [],
+        bomList: []
+      };
+    },
+
+    created() {
+      this.getDictList('productionType');
+
+      this.getBomList();
+
+      this.getContactList();
+    },
+
+    methods: {
+      /* 表格数据源 */
+
+      getBomList() {
+        let params = {
+          pageNum: 1,
+          bomType: 1,
+          categoryId: this.rowDataBom.id,
+          size: -1
+        };
+        getBom(params).then((res) => {
+          this.bomList = res?.bomList || [];
+          console.log(res, 'res');
+        });
+      },
+      selected() {
+        let _arr = [];
+        if (!this.selection.length) {
+          this.$message.error('请至少选择一条数据');
+          return;
+        }
+
+        _arr = this.selection.map((m) => {
+          m.findex = this.rowDataBom.fIndex;
+          m.categoryId = m.id;
+          delete m.id;
+          return {
+            ...m
+          };
+        });
+
+        this.$emit('chooseRadio', _arr);
+        this.handleClose();
+      },
+
+      async getDictList(code) {
+        let { data: res } = await getByCode(code);
+        this.dictList = res.map((item) => {
+          let values = Object.keys(item);
+          return {
+            value: Number(values[0]),
+            label: item[values[0]]
+          };
+        });
+      },
+
+      getContactList() {
+        let param = {
+          pageNum: 1,
+          type: 2,
+          size: -1,
+          status: 1
+        };
+        contactList(param).then((res) => {
+          this.gysList = res.list;
+        });
+      },
+      bomClose() {
+        this.$nextTick(() => {
+          this.$refs.table.reload({
+            pageNum: 1
+          });
+        });
+      },
+
+      /* 刷新表格 */
+      reload(where) {
+        this.$refs.table.reload({ where, size: 1, pageNum: 10 });
+      },
+
+      handleClose() {
+        this.$emit('update:bomDetailDialogFlag', false);
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .tree_col {
+    border: 1px solid #eee;
+    padding: 10px 0;
+    box-sizing: border-box;
+    height: 500px;
+    overflow: auto;
+  }
+
+  .table_col {
+    padding-left: 10px;
+
+    ::v-deep .el-table th.el-table__cell {
+      background: #f2f2f2;
+    }
+  }
+
+  .pagination {
+    text-align: right;
+    padding: 10px 0;
+  }
+
+  .btns {
+    text-align: center;
+    padding: 10px 0;
+  }
+
+  .topsearch {
+    margin-bottom: 15px;
+  }
+</style>

+ 57 - 4
src/views/rulesManagement/matterRules/components/matter-add.vue

@@ -90,7 +90,27 @@
               >
             </template>
           </el-table-column>
-          <el-table-column prop="name" label="事项" width="200">
+          <el-table-column prop="categoryCode" label="零部件编码" width="160">
+            <template slot-scope="scope">
+              <el-input
+                @click.native="
+                  openpartDialog(scope.row, scope.$index, '零部件')
+                "
+                v-model="scope.row.categoryCode"
+              ></el-input>
+            </template>
+          </el-table-column>
+          <el-table-column prop="categoryName" label="零部件名称" width="160">
+            <template slot-scope="scope">
+              <el-input
+                @click.native="
+                  openpartDialog(scope.row, scope.$index, '零部件')
+                "
+                v-model="scope.row.categoryName"
+              ></el-input>
+            </template>
+          </el-table-column>
+          <el-table-column prop="name" label="事项" width="240">
             <template slot-scope="scope">
               <el-form-item
                 :prop="'ruleItems.' + scope.$index + '.name'"
@@ -197,6 +217,8 @@
       </template>
     </ele-modal>
     <operation-guideDialog ref="operationGuideDialog" @save="saveEdit" />
+    <!-- 零部件 -->
+    <ProductModal ref="productRefs" @chooseRadio="chooseRadio" />
   </div>
 </template>
 <script>
@@ -209,8 +231,10 @@
     getDetail
   } from '@/api/ruleManagement/matter';
 
+  import ProductModal from './ProductModal.vue';
+
   export default {
-    components: { RuleCycle, OperationGuideDialog },
+    components: { RuleCycle, OperationGuideDialog, ProductModal },
     props: {
       pageType: {
         type: String,
@@ -291,6 +315,11 @@
     },
     watch: {},
     methods: {
+      openpartDialog(row, index, type) {
+        this.$nextTick(() => {
+          this.$refs.productRefs.open2(row, index, type);
+        });
+      },
       saveEdit(data, index) {
         console.log(data);
         console.log(index);
@@ -340,7 +369,7 @@
           this.formData.ruleItems.push({
             name: '', // 巡点检事项
             content: '', // 巡点检内容
-            norm: '', // 巡点检标准
+            norm: '正常', // 巡点检标准
             // 操作指导
             operationGuide: {
               toolList: [],
@@ -353,7 +382,7 @@
             {
               name: '', // 巡点检事项
               content: '', // 巡点检内容
-              norm: '', // 巡点检标准
+              norm: '正常', // 巡点检标准
               // 操作指导
               operationGuide: {
                 toolList: [],
@@ -371,6 +400,8 @@
           let name = row.name;
           let content = row.content;
           let norm = row.norm;
+          /*  let categoryCode = row.categoryCode;
+          let categoryName = row.categoryName; */
           flag = name && content && norm;
           this.$refs.contentConfigForm.validate((valid) => {
             if (valid || flag) {
@@ -401,6 +432,7 @@
 
       // 保存
       dataKeep() {
+        console.log(this.formData, '123');
         let form = deepClone(this.formData);
         console.log(this.$refs.cycleMultipleRef);
         form.cycle = this.$refs.cycleMultipleRef.ruleCycleList;
@@ -499,6 +531,27 @@
         } else {
           this.$message.error('请添加事项内容!');
         }
+      },
+      chooseRadio(val) {
+        if (val.length > 0) {
+          const findex = val[0].findex;
+          const items = val.map((item) => ({
+            ...this.formData.ruleItems[findex],
+            categoryCode: item.code,
+            categoryName: item.name
+          }));
+          this.formData.ruleItems.splice(findex + 1, 0, ...items);
+          this.formData.ruleItems.splice(findex, 1);
+        }
+        /*  for (let i = 0; i < this.formData.ruleItems.length; i++) {
+          for (let j = 0; j < val.length; j++) {
+            const element2 = val[j].findex;
+            if (element2 == i) {
+              this.formData.ruleItems[i].categoryCode = val[j].code;
+              this.formData.ruleItems[i].categoryName = val[j].name;
+            }
+          }
+        } */
       }
     }
   };

+ 67 - 53
src/views/rulesManagement/matterRules/components/matter-search.vue

@@ -11,58 +11,75 @@
         <el-form-item label="规则名称:">
           <el-input clearable v-model.trim="where.name" placeholder="请输入" />
         </el-form-item>
-		<el-form-item label="规则状态:">
-		  <DictSelection dictName="规则状态" clearable v-model.trim="where.status">
-		  </DictSelection>
-		</el-form-item>
+        <el-form-item label="规则状态:">
+          <DictSelection
+            dictName="规则状态"
+            clearable
+            v-model.trim="where.status"
+          >
+          </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.code" placeholder="请输入" />
         </el-form-item>
         <el-form-item label="创建时间:">
-            <el-date-picker
-              style="width: 100%;"
-                v-model="time"
-                type="daterange"
-                range-separator="至"
-                start-placeholder="开始日期"
-                end-placeholder="结束日期"
-				value-format="yyyy-MM-dd HH:mm:ss"
-				:default-time="['00:00:00', '23:59:59']"
-        	  >
-            </el-date-picker>
+          <el-date-picker
+            style="width: 100%"
+            v-model="time"
+            type="daterange"
+            range-separator="至"
+            start-placeholder="开始日期"
+            end-placeholder="结束日期"
+            value-format="yyyy-MM-dd HH:mm:ss"
+            :default-time="['00:00:00', '23:59:59']"
+          >
+          </el-date-picker>
         </el-form-item>
       </el-col>
       <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
         <el-form-item label="规则类型:">
-          <DictSelection dictName="规则类型" clearable v-model.trim="where.type">
+          <DictSelection
+            dictName="规则类型"
+            clearable
+            v-model.trim="where.type"
+          >
           </DictSelection>
         </el-form-item>
         <el-form-item label="组织机构:">
-          <auth-selection v-model.trim="where.deptIds" style="width: 100%"></auth-selection>
+          <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-input clearable v-model.trim="where.userName" placeholder="请输入" />
+          <el-input
+            clearable
+            v-model.trim="where.userName"
+            placeholder="请输入"
+          />
         </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>
+        <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>
@@ -76,17 +93,17 @@
       const defaultWhere = {
         name: '',
         code: '',
-        userName:'',
-        type:'',
-		status:'',
-		startTime:'',
-		endTime:''
+        userName: '',
+        type: '',
+        status: '',
+        startTime: '',
+        endTime: ''
       };
       return {
         // 表单数据
         where: { ...defaultWhere },
-        treeData:[],
-		time:[]
+        treeData: [],
+        time: []
       };
     },
     computed: {
@@ -95,20 +112,17 @@
         return this.$store.state.theme.styleResponsive;
       }
     },
-    created(){
-    },
+    created() {},
     methods: {
       /* 搜索 */
       search() {
-		if(this.time.length){
-			this.where.startTime = this.time[0]
-			this.where.endTime = this.time[1]
-		}
+        this.where.startTime = this.time ? this.time[0] : '';
+        this.where.endTime = this.time ? this.time[1] : '';
         this.$emit('search', this.where);
       },
       /*  重置 */
       reset() {
-		this.time = []
+        this.time = [];
         this.where = { ...this.defaultWhere };
         this.search();
       }
@@ -116,9 +130,9 @@
   };
 </script>
 <style lang="scss" scoped>
-    .ele-form-actions{
-		display:flex;
-		align-items: center;
-		justify-content: flex-end;
-	}
+  .ele-form-actions {
+    display: flex;
+    align-items: center;
+    justify-content: flex-end;
+  }
 </style>

+ 16 - 1
src/views/system/unifiedPortal/dialog.vue

@@ -62,7 +62,17 @@
       </el-form-item>
       <el-form-item label="链接" required>
         <el-input placeholder="请输入内容" v-model="form.linkUrl">
-          <template slot="prepend">https://</template>
+          <!--  <template slot="prepend">https://</template> -->
+          <el-select
+            v-model="select"
+            slot="prepend"
+            placeholder="请选择"
+            style="width: 100px"
+            @change="changeSelect"
+          >
+            <el-option label="http://" value="http://"></el-option>
+            <el-option label="https://" value="https://"></el-option>
+          </el-select>
         </el-input>
       </el-form-item>
       <el-form-item label="链接类型" required>
@@ -107,6 +117,7 @@
           linkType: '1',
           architType: '1'
         },
+        select: '',
         imageUrl: '',
         options: [
           {
@@ -165,6 +176,10 @@
           this.file = file.raw; //赋值文件对象,用于上传操作
         }
       },
+      changeSelect() {
+        let urlWithoutProtocol = this.form.linkUrl.replace(/^https?:\/\//, '');
+        this.form.linkUrl = `${this.select}${urlWithoutProtocol}`;
+      },
       async config() {
         if (!this.form.name) {
           return this.$message.error('请输入名称');