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

产品管理编辑填写部分完成

LAPTOP-16IUEB3P\Lenovo 2 лет назад
Родитель
Сommit
16193e9567

+ 93 - 32
src/views/material/product/detail.vue

@@ -141,23 +141,19 @@
     <!-- 分类选择弹窗 -->
     <CategoryDialog ref="categoryRefs" @chooseCategory="confirmCategory" />
     <!-- 仓储配置 -->
-    <WarehouseInfo ref="warehouseRefs" :form="form" />
-    <!-- 采购 -->
-    <ProcureInfo ref="procureRefs" :form="form" />
+    <WarehouseInfo ref="warehouseRefs" :form="categoryWms" />
     <!-- 生产信息 -->
-    <ProductionInfo ref="productionRefs" :form="form" />
+    <ProductionInfo ref="productionRefs" :form="categoryMes" />
     <!-- 计划 -->
-    <PlanInfo ref="planRefs" :form="form" />
-    <!-- 销售信息 -->
-    <SalesInfo ref="salesRefs" :form="form" />
+    <PlanInfo ref="planRefs" :form="categoryAps" />
     <!-- 质量配置 -->
-    <QualityInfo ref="qualityRefs" :form="form" />
+    <QualityInfo ref="qualityRefs" :form="categoryQms" />
     <!-- 舟皿信息 -->
-    <BoatInfo ref="qualityRefs" :form="form" />
+    <BoatInfo ref="qualityRefs" :form="categoryPallet" />
     <!-- 周转车信息 -->
-    <TurnoverInfo ref="turnoverRefs" :form="form" />
+    <TurnoverInfo ref="turnoverRefs" :form="categoryVehicle" />
     <!-- 模具信息 -->
-    <MoldInfo ref="moldRefs" :form="form" />
+    <MoldInfo ref="moldRefs" :form="categoryMold" />
     <!-- 备注信息 -->
     <RemarkInfo ref="remarkRefs" :form="remarkform" />
     <!-- 关联信息 -->
@@ -182,7 +178,8 @@
   import personSelect from '@/components/CommomSelect/person-select.vue';
   import linkMsg from './components/link-msg.vue';
   import { getDetails } from '@/api/classifyManage/itemInformation';
-  import { editMaterial } from '@/api/material/manage.js';
+  import { addMaterial } from '@/api/material/manage.js';
+  import { deepClone } from '@/utils/index';
   export default {
     name: 'ManageMaterial',
     components: {
@@ -209,7 +206,16 @@
           categoryLevelGroupName: '',
           categoryLevelName: ''
         },
-        remarkform: {},
+        remarkform: {
+          remarkAttach:[]
+        },
+        categoryAps:{},
+        categoryMes:{},
+        categoryMold:{},
+        categoryPallet:{},
+        categoryQms:{},
+        categoryVehicle:{},
+        categoryWms:{},
         // 表单验证规则
         rules: {
           categoryLevelGroupName: [
@@ -223,7 +229,8 @@
           measuringUnit: [
             { required: true, message: '请选择计量单位', trigger: 'change' }
           ]
-        }
+        },
+        PathInfo:{},
       };
     },
     created () {
@@ -232,10 +239,51 @@
     methods: {
       async _getDetails () {
         const data = await getDetails(this.$route.query.id);
-        this.form = data;
-
+        const info = deepClone(data)
+        this.form = {
+          ...info.category
+        }
+        this.judgeSet(info)
         this.searchDeptNodeClick(this.form.deptLeaderId);
       },
+      // 判断字段类型并赋值
+      judgeSet(info){
+         if(typeof info.categoryAps == 'string'){
+            this.categoryAps = {}
+         }else{
+            this.categoryAps = info.categoryAps
+         }
+         if(typeof info.categoryMes == 'string'){
+            this.categoryMes = {}
+         }else{
+            this.categoryMes = info.categoryMes
+         }
+         if(typeof info.categoryMold == 'string'){
+            this.categoryMold = {}
+         }else{
+            this.categoryMold = info.categoryMold
+         }
+         if(typeof info.categoryPallet == 'string'){
+            this.categoryPallet = {}
+         }else{
+            this.categoryPallet = info.categoryPallet
+         }
+         if(typeof info.categoryQms == 'string'){
+            this.categoryQms = {}
+         }else{
+            this.categoryQms = info.categoryQms
+         }
+         if(typeof info.categoryVehicle == 'string'){
+            this.categoryVehicle = {}
+         }else{
+            this.categoryVehicle = info.categoryVehicle
+         }
+         if(typeof info.categoryWms == 'string'){
+            this.categoryWms = {}
+         }else{
+            this.categoryWms = info.categoryWms
+         }
+      },
       // 选择所属部门
       searchDeptNodeClick (id, info) {
         // 根据部门获取人员
@@ -247,7 +295,7 @@
       //选择负责人
       handleDirectorChange (id, info) {},
       // 确定分类
-      confirmCategory (node, title) {
+      confirmCategory (node, title,PathInfo) {
         if (title == '选择产品分类') {
           this.$set(this.form, 'productCategoryLevelName', node.name);
           this.$set(this.form, 'productCategoryLevelId', node.id);
@@ -256,6 +304,7 @@
           this.$set(this.form, 'categoryLevelId', node.id);
           this.$set(this.form, 'categoryLevelPath', node.name);
           this.$set(this.form, 'categoryLevelPathId', node.id);
+          this.PathInfo = PathInfo
         }
       },
       openCategory () {
@@ -272,26 +321,38 @@
             return false;
           }
           this.loading = true;
-          const imgList = this.remarkform.imgList;
-          const arr = [];
-          if (imgList.length) {
-            imgList.map((item) => {
-              arr.push(item.storePath);
-            });
-            this.form.remarkAttach = arr.join(',');
-          }
-          this.form.remark = this.remarkform.remark
-            ? this.remarkform.remark
-            : '';
+          // const imgList = this.remarkform.imgList;
+          // const arr = [];
+          // if (imgList.length) {
+          //   imgList.map((item) => {
+          //     arr.push(item.storePath);
+          //   });
+          //   this.form.remarkAttach = arr.join(',');
+          // }
+          // this.form.remark = this.remarkform.remark
+          //   ? this.remarkform.remark
+          //   : '';
           const data = {
-            ...this.form
+            categoryWms:this.categoryWms,
+            categoryAps:this.categoryAps,
+            categoryMes:this.categoryMes,
+            categoryMold:this.categoryMold,
+            categoryPallet:this.categoryPallet,
+            categoryQms:this.categoryQms,
+            categoryVehicle:this.categoryVehicle,
+            category:{
+              ...this.form,
+              ...this.remarkform,
+              ...this.PathInfo
+            }
           };
-          editMaterial(data)
+          addMaterial(data)
             .then((msg) => {
               this.loading = false;
               this.$message.success(msg);
-              this.updateVisible(false);
-              this.$emit('done');
+              finishPageTab()
+              reloadPageTab({ fullPath: '/material/product' });
+              this.$router.go(-1)
             })
             .catch((e) => {
               this.loading = false;

+ 8 - 1
src/views/material/product/index.vue

@@ -26,7 +26,14 @@
           >
             <!-- 表头工具栏 -->
             <template v-slot:action="{ row }">
-              <el-link type="primary" @click="handleEdit(row)">编辑</el-link>
+              <el-link
+                type="primary"
+                :underline="false"
+                icon="el-icon-edit"
+                @click="handleEdit(row)"
+              >
+                修改
+              </el-link>
             </template>
           </ele-pro-table>
         </template>

+ 1 - 2
src/views/material/productLinkMaterial/components/product-search.vue

@@ -28,7 +28,7 @@
         </el-form-item>
       </el-col>
       <el-col v-bind="styleResponsive ? { md: 4 } : { span: 4 }">
-        <el-form-item>
+        <el-form-item label-width="0">
           <el-button
             type="primary"
             icon="el-icon-search"
@@ -37,7 +37,6 @@
           >
             查询
           </el-button>
-
           <el-button
             @click="reset"
             icon="el-icon-refresh"