ysy hace 1 año
padre
commit
66e8b1885e

+ 1 - 15
src/views/material/BOMmanage/components/BOM-search.vue

@@ -59,21 +59,7 @@
       </el-col>
 
 
-      <el-col v-bind="styleResponsive ? { md: 6 } : { span: 6 }">
-        <el-form-item label="查父级">
-          <el-select
-            clearable
-            v-model.trim="where.parentId"
-            placeholder="请选择"
-            class="w100"
-          >
-          <el-option :value="0" label="是"></el-option>
-          <el-option :value="1" label="否"></el-option>
 
-      
-          </el-select>
-        </el-form-item>
-      </el-col>
 
       <el-col v-bind="styleResponsive ? { md: 12 } : { span: 12 }">
         <div class="ele-form-actions">
@@ -109,7 +95,7 @@
         categoryCode: this.categoryCode,
         categoryName: '',
         status: '',
-        parentId: 0,
+
       };
       return {
         defaultWhere,

+ 137 - 119
src/views/material/BOMmanage/components/attribute.vue

@@ -1,22 +1,142 @@
 <template>
   <div>
     <el-form label-width="100px" ref="form" :model="attributeData">
-
-
       <el-row>
-        <el-col :span="16" label-width="100px">
-          <el-form-item label="编码" prop="code">
-            <el-input placeholder="" v-model="attributeData.code"></el-input>
+        <el-col :span="8"  label-width="100px">
+          <el-form-item label="名称:" prop="category.name">
+            <el-input
+              placeholder=""
+              v-model="category.name"
+              disabled
+            ></el-input>
           </el-form-item>
         </el-col>
-      </el-row>
 
-      <el-row>
-        <el-col :span="16" label-width="100px">
-          <el-form-item label="名称" prop="name">
-            <el-input placeholder="" v-model="attributeData.name"></el-input>
-          </el-form-item>
-        </el-col>
+ 
+          <el-col :span="8"  label-width="100px">
+            <el-form-item label="编码:" prop="code">
+              <el-input
+                placeholder=""
+                v-model="category.code"
+                disabled
+              ></el-input>
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="8" label-width="100px">
+            <el-form-item label="牌号:" prop="brandNum">
+              <el-input
+                placeholder=""
+                v-model="category.brandNum"
+                disabled
+              ></el-input>
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="8" label-width="100px">
+            <el-form-item label="型号:" prop="modelType">
+              <el-input
+                placeholder=""
+                v-model="category.modelType"
+                disabled
+              ></el-input>
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="8" label-width="100px">
+            <el-form-item label="规格:" prop="specification">
+              <el-input
+                placeholder=""
+                v-model="category.specification"
+                disabled
+              ></el-input>
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="8" label-width="100px">
+            <el-form-item label="计量单位:" prop="measuringUnit">
+              <el-input
+                placeholder=""
+                v-model="category.measuringUnit"
+                disabled
+              ></el-input>
+              
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="8" label-width="100px">
+            <el-form-item label="重量单位:" prop="weightUnit">
+
+              <el-input
+                placeholder=""
+                v-model="category.weightUnit"
+                disabled
+              ></el-input>
+
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="8" label-width="100px">
+            <el-form-item label="包装单位:" prop="packingUnit">
+              <el-input
+                placeholder=""
+                v-model="category.packingUnit"
+                disabled
+              ></el-input>
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="8" label-width="100px">
+            <el-form-item label="毛重:" prop="roughWeight">
+              <el-input
+                placeholder=""
+                v-model="category.roughWeight"
+                disabled
+              ></el-input>
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="8" label-width="100px">
+            <el-form-item label="净重:" prop="netWeight">
+              <el-input
+                placeholder=""
+                v-model="category.netWeight"
+                disabled
+              ></el-input>
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="8" label-width="100px">
+            <el-form-item
+              label="加工类型:"
+              prop="isConsumable"
+              v-if="
+                [1, 23, 9, 28].includes(Number(category.categoryLevelPathId))
+              "
+            >
+            <el-input
+                placeholder=""
+                :v-model="category.isConsumable == 1 ? '批量' : '单件'"
+                disabled
+              ></el-input>
+   
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="8" label-width="100px">
+            <el-form-item label="生产类型:" prop="produceType">
+              <el-input
+                placeholder=""
+                :v-model="  category.produceType &&
+                ['自制件', '采购件', '装配件', '外协件'][
+                  category.produceType - 1
+                ]"
+                disabled
+              ></el-input>
+          
+            </el-form-item>
+          </el-col>
+       
       </el-row>
 
       <el-row>
@@ -137,106 +257,16 @@
         </el-col>
       </el-row>
 
-      <el-row style="margin-top: 18px">
-        <el-divider>产品信息</el-divider>
-
-        <el-col style="margin-top: 18px" :span="12" label-width="100px">
-          <el-form-item label="产品:" prop="category.name">
-            <el-input
-              placeholder="请选择产品"
-              @click.native="handleProduct()"
-              v-model="category.name"
-            ></el-input>
-          </el-form-item>
-        </el-col>
-
-        <div v-if="category.name">
-          <el-col style="margin-top: 18px" :span="12" label-width="100px">
-            <el-form-item label="编码:" prop="code">
-              {{ category.code }}
-            </el-form-item>
-          </el-col>
-
-          <el-col :span="12" label-width="100px">
-            <el-form-item label="牌号:" prop="brandNum">
-              {{ category.brandNum }}
-            </el-form-item>
-          </el-col>
-
-          <el-col :span="12" label-width="100px">
-            <el-form-item label="型号:" prop="modelType">
-              {{ category.modelType }}
-            </el-form-item>
-          </el-col>
-
-          <el-col :span="12" label-width="100px">
-            <el-form-item label="规格:" prop="specification">
-              {{ category.specification }}
-            </el-form-item>
-          </el-col>
-
-          <el-col :span="12" label-width="100px">
-            <el-form-item label="计量单位:" prop="measuringUnit">
-              {{ category.measuringUnit }}
-            </el-form-item>
-          </el-col>
-
-          <el-col :span="12" label-width="100px">
-            <el-form-item label="重量单位:" prop="weightUnit">
-              {{ category.weightUnit }}
-            </el-form-item>
-          </el-col>
-
-          <el-col :span="12" label-width="100px">
-            <el-form-item label="包装单位:" prop="packingUnit">
-              {{ category.packingUnit }}
-            </el-form-item>
-          </el-col>
-
-          <el-col :span="12" label-width="100px">
-            <el-form-item label="毛重:" prop="roughWeight">
-              {{ category.roughWeight }}
-            </el-form-item>
-          </el-col>
-
-          <el-col :span="12" label-width="100px">
-            <el-form-item label="净重:" prop="netWeight">
-              {{ category.netWeight }}
-            </el-form-item>
-          </el-col>
-
-          <el-col :span="12" label-width="100px">
-            <el-form-item
-              label="加工类型:"
-              prop="isConsumable"
-              v-if="
-                [1, 23, 9, 28].includes(Number(category.categoryLevelPathId))
-              "
-            >
-              {{ category.isConsumable == 1 ? '批量' : '单件' }}
-            </el-form-item>
-          </el-col>
-        </div>
-      </el-row>
-
-      <div class="btn_box">
+      <!-- <div class="btn_box">
         <el-button type="primary">修改</el-button>
-      </div>
+      </div> -->
     </el-form>
-
-    <standardOutput
-      ref="standardOutputRefs"
-      @selection="chooseStandardList"
-    ></standardOutput>
   </div>
 </template>
 
 <script>
-  import standardOutput from './standardOutput.vue';
   export default {
-    components: {
-      standardOutput
-    },
+    components: {},
     data() {
       return {
         form: {},
@@ -272,20 +302,8 @@
 
     created() {},
 
-    beforeDestroy() {
-      this.category = { name: '' };
-    },
-    methods: {
-      handleProduct() {
-        this.$refs.standardOutputRefs.open(9);
-      },
-      chooseStandardList(type, data) {
-        if (type == 9) {
-          this.category = data[0];
-          this.$forceUpdate();
-        }
-      }
-    },
+    beforeDestroy() {},
+    methods: {},
     props: {
       attributeData: {
         type: Object,

+ 40 - 111
src/views/material/BOMmanage/components/bomTreeDialog.vue

@@ -17,6 +17,7 @@
       <el-row>
         <el-col :span="12" label-width="100px">
           <el-form-item label="父级节点" prop="parentId">
+
             <selectTree
               ref="tree"
               class="form-ipt"
@@ -27,7 +28,7 @@
               :options="bomTreeList"
               @getValue="getTreeValue"
               :props="{
-                value: 'bomId',
+                value: 'id',
                 label: 'name',
                 children: 'children'
               }"
@@ -57,15 +58,14 @@
         </el-col>
 
         <el-col :span="12" label-width="100px">
-          <el-form-item label="编码" prop="code">
-            <el-input placeholder="" v-model="attributeData.code"></el-input>
+          <el-form-item label="编码" prop="category.code">
+            <el-input placeholder=""     @click.native="handleProduct()" v-model="category.code"></el-input>
           </el-form-item>
         </el-col>
 
-
         <el-col :span="12" label-width="100px">
-          <el-form-item label="名称" prop="name">
-            <el-input placeholder="" v-model="attributeData.name"></el-input>
+          <el-form-item label="名称" prop="category.name">
+            <el-input placeholder="" v-model="category.name"></el-input>
           </el-form-item>
         </el-col>
 
@@ -96,10 +96,6 @@
           </el-form-item>
         </el-col>
 
-
-
-        
-
         <el-col :span="12" label-width="100px">
           <el-form-item label="用量" prop="dosage">
             <el-input placeholder="" v-model="attributeData.dosage"></el-input>
@@ -163,87 +159,6 @@
         </el-col>
       </el-row>
 
-      <el-row style="margin-top: 18px">
-        <el-divider>产品信息</el-divider>
-
-        <el-col style="margin-top: 18px" :span="12" label-width="100px">
-          <el-form-item label="产品:" prop="category.name">
-            <el-input
-              placeholder="请选择产品"
-              @click.native="handleProduct()"
-              v-model="category.name"
-            ></el-input>
-          </el-form-item>
-        </el-col>
-
-        <div v-if="category.name">
-          <el-col style="margin-top: 18px" :span="12" label-width="100px">
-            <el-form-item label="编码:" prop="code">
-              {{ category.code }}
-            </el-form-item>
-          </el-col>
-
-          <el-col :span="12" label-width="100px">
-            <el-form-item label="牌号:" prop="brandNum">
-              {{ category.brandNum }}
-            </el-form-item>
-          </el-col>
-
-          <el-col :span="12" label-width="100px">
-            <el-form-item label="型号:" prop="modelType">
-              {{ category.modelType }}
-            </el-form-item>
-          </el-col>
-
-          <el-col :span="12" label-width="100px">
-            <el-form-item label="规格:" prop="specification">
-              {{ category.specification }}
-            </el-form-item>
-          </el-col>
-
-          <el-col :span="12" label-width="100px">
-            <el-form-item label="计量单位:" prop="measuringUnit">
-              {{ category.measuringUnit }}
-            </el-form-item>
-          </el-col>
-
-          <el-col :span="12" label-width="100px">
-            <el-form-item label="重量单位:" prop="weightUnit">
-              {{ category.weightUnit }}
-            </el-form-item>
-          </el-col>
-
-          <el-col :span="12" label-width="100px">
-            <el-form-item label="包装单位:" prop="packingUnit">
-              {{ category.packingUnit }}
-            </el-form-item>
-          </el-col>
-
-          <el-col :span="12" label-width="100px">
-            <el-form-item label="毛重:" prop="roughWeight">
-              {{ category.roughWeight }}
-            </el-form-item>
-          </el-col>
-
-          <el-col :span="12" label-width="100px">
-            <el-form-item label="净重:" prop="netWeight">
-              {{ category.netWeight }}
-            </el-form-item>
-          </el-col>
-
-          <el-col :span="12" label-width="100px">
-            <el-form-item
-              label="加工类型:"
-              prop="isConsumable"
-              v-if="
-                [1, 23, 9, 28].includes(Number(category.categoryLevelPathId))
-              "
-            >
-              {{ category.isConsumable == 1 ? '批量' : '单件' }}
-            </el-form-item>
-          </el-col>
-        </div>
-      </el-row>
     </el-form>
     <div class="btns">
       <el-button type="primary" size="small" @click="save">保存</el-button>
@@ -260,7 +175,7 @@
 <script>
   import { getBomTreeList, saveBomTreeList } from '@/api/material/BOM.js';
   import selectTree from '@/components/selectTree';
-  import producetask from '@/api/technology/production';
+
   import userSearch from './user-search.vue';
   import standardOutput from './standardOutput.vue';
   export default {
@@ -279,16 +194,13 @@
         },
 
         category: {
-          name: ''
+          name: '',
+          code: ''
         },
 
         rules: {
-          parentId: [
-            { required: true, message: '请选择父级节点', trigger: 'change' }
-          ],
-          code: [{ required: true, message: '请选择编码', trigger: 'change' }],
-
-          name: [{ required: true, message: '请选择名称', trigger: 'change' }]
+        
+  
         },
         bomTreeList: [],
         statusOptions: [
@@ -304,15 +216,15 @@
         bomTypeOptions: [
           {
             label: 'PBOM',
-            value: "1"
+            value: '1'
           },
           {
             label: 'MBOM',
-            value: "2"
+            value: '2'
           },
           {
             label: 'ABOM',
-            value: "3"
+            value: '3'
           }
         ]
       };
@@ -320,14 +232,27 @@
 
     methods: {
       getTreeValue(data) {
-        this.attributeData.parentId = data.id;
-        this.attributeData.level = +data.level + 1;
+        this.category = {
+          name: '',
+          code: ''
+        }
+        if(data) {
+          this.attributeData.parentId = data.id;
+          this.attributeData.level =  +data.level + 1;
+        } else {
+          this.attributeData.parentId = null
+          this.attributeData.level = null
+        }
+      
+
+
       },
       save() {
-        this.$refs.form.validate((valid) => {
-          if (!valid) {
-            return false;
+          if(!this.category.code) {
+            this.$message.error('编码不能为空');
+            return;
           }
+
           if (!this.attributeData.parentId) {
             this.attributeData.parentId = 0;
             this.attributeData.level = 1;
@@ -339,7 +264,7 @@
               this.$emit('reload', this.attributeData.versions);
               this.handleClose();
             }
-          });
+    
         });
       },
       versionsChange(versions) {
@@ -348,21 +273,23 @@
       },
 
       handleProduct() {
-        this.$refs.standardOutputRefs.open(9);
+        this.$refs.standardOutputRefs.open(this.attributeData.parentId ? 1 : 9 );
       },
       chooseStandardList(type, data) {
-        if (type == 9) {
+        if (type == 9 || type == 1) {
           this.category = data[0];
           this.$forceUpdate();
         }
       },
 
-      async open(type, versions, categoryId) {
+      async open(type, versions, categoryId, treeId) {
         this.attributeData = {};
         this.attributeData.bomType = type;
         this.attributeData.categoryId = categoryId;
         this.attributeData.versions = versions;
         this.versions = versions;
+
+        console.log(treeId);
         const res = await getBomTreeList({
           categoryId,
           versions,
@@ -370,6 +297,8 @@
         });
         console.log(this.attributeData);
         this.bomTreeList = res.data;
+        this.attributeData.parentId = treeId;
+        this.$forceUpdate();
         this.visible = true;
       },
       handleClose() {

+ 5 - 2
src/views/material/BOMmanage/details.vue

@@ -180,7 +180,8 @@
         categoryId: 1,
         versions: null,
         loadingInstance: null,
-        noBack: false
+        noBack: false,
+        treeId: null
       };
     },
     mounted() {
@@ -275,7 +276,8 @@
         this.$refs.bomTreeDialogRef.open(
           this.currentNodeData.bomType,
           this.versions,
-          this.categoryId
+          this.categoryId,
+         this.treeId
         );
       },
       async getTreeData() {
@@ -307,6 +309,7 @@
       },
 
       handleNodeClick(data) {
+        this.treeId  = data.id;
         this.handBomDetails(data.id);
       },