ysy před 1 rokem
rodič
revize
6400ee2500

binární
src/assets/logo.png


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

@@ -43,7 +43,7 @@
             >导入</el-button
             >导入</el-button
           >
           >
         </div>
         </div>
-        <el-button
+        <!-- <el-button
           v-if="rootTreeId == 9"
           v-if="rootTreeId == 9"
           size="small"
           size="small"
           type="primary"
           type="primary"
@@ -77,8 +77,8 @@
           size="small"
           size="small"
           type="primary"
           type="primary"
           @click="handleLink('6')"
           @click="handleLink('6')"
-          >关联备品备件</el-button
-        >
+          >关联备品备件</el-button 
+        >-->
       </template>
       </template>
       <template v-slot:action="{ row }">
       <template v-slot:action="{ row }">
         <el-link type="primary" :underline="false" @click="openEdit(row, 1)">
         <el-link type="primary" :underline="false" @click="openEdit(row, 1)">
@@ -124,14 +124,14 @@
           物料BOM
           物料BOM
         </el-link>
         </el-link>
 
 
-        <el-link
+        <!-- <el-link
           type="primary"
           type="primary"
           v-if="row.isProduct == 1"
           v-if="row.isProduct == 1"
           :underline="false"
           :underline="false"
           @click="openMould(row)"
           @click="openMould(row)"
         >
         >
           模具
           模具
-        </el-link>
+        </el-link> -->
 
 
         <el-link
         <el-link
           type="primary"
           type="primary"

+ 6 - 3
src/views/material/product/detail.vue

@@ -26,13 +26,13 @@
 
 
           <el-col :span="8" v-if="ruleCode == '自定义'" key="1">
           <el-col :span="8" v-if="ruleCode == '自定义'" key="1">
             <el-form-item label="编码" prop="code">
             <el-form-item label="编码" prop="code">
-              <el-input v-model="form.code" readonly @click.native="openCode" />
+              <el-input v-model="form.code" readonly @click.native="openCode"  :disabled="status == 0" />
             </el-form-item>
             </el-form-item>
           </el-col>
           </el-col>
 
 
           <el-col :span="8" v-else key="2">
           <el-col :span="8" v-else key="2">
             <el-form-item label="编码" prop="code">
             <el-form-item label="编码" prop="code">
-              <el-input v-model="form.code" />
+              <el-input v-model="form.code"   :disabled="status == 0" />
             </el-form-item>
             </el-form-item>
           </el-col>
           </el-col>
 
 
@@ -327,10 +327,13 @@
         id: null,
         id: null,
 
 
         ruleCode: null,
         ruleCode: null,
-        codeShow: false
+        codeShow: false,
+
+        status: null
       };
       };
     },
     },
     async created() {
     async created() {
+      this.status = this.$route.query.status;
       if (this.$route.query.id) {
       if (this.$route.query.id) {
         this._getDetails();
         this._getDetails();
       }
       }

+ 242 - 0
src/views/material/product/oneProduct.vue

@@ -0,0 +1,242 @@
+<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">
+              </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,
+      IndexSearch
+    },
+    mixins: [dictMixins],
+    data() {
+      return {
+        loading: false,
+        current: {},
+        curNode: {},
+        treeList: [],
+        treeLoading: false,
+        formData: {},
+         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 = '';
+        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;
+  
+          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.getDetail(this.treeList[0].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
+        }
+  
+  
+        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])
+            // 用当前节点再去原数据查找当前节点的父节点
+            this.findParent(parents, treeList[i], this.treeList)
+            break
+          } else {
+            if (treeList[i].children instanceof Array) {
+              //	没找到,遍历该节点的子节点
+              this.findParent(parents, childNode, treeList[i].children)
+            }
+          }
+        }
+        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: 40px;
+  
+    &>.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>
+