huang_an 1 год назад
Родитель
Сommit
a7ec3f8305

+ 2 - 0
src/views/material/product/components/WarehouseInfo.vue

@@ -278,6 +278,7 @@
                 ids: filters.map((item) => item.id)
               });
               filters.map((item) => {
+                obj['id' + item.sort] = item.id;
                 switch (item.sort) {
                   case '0':
                     obj.code = item.code;
@@ -298,6 +299,7 @@
                     break;
                 }
               });
+
               arr.push(obj);
             });
             this.packagingSpecification = arr;

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

@@ -26,9 +26,41 @@
           新建
         </el-button>
 
+        <div class="upload" v-if="rootTreeId == 6">
+          <el-upload
+            v-if="!isLoading"
+            :show-file-list="false"
+            class="upload-demo"
+            action=""
+            :before-upload="beforeUpload"
+            :on-success="successUpload"
+            :on-error="errorUpload"
+          >
+            <slot>
+              <el-button
+                type="primary"
+                size="small"
+                plain
+                icon="el-icon-upload2"
+                >导入</el-button
+              >
+            </slot>
+          </el-upload>
+          <el-button
+            v-else
+            type="primary"
+            size="small"
+            icon="el-icon-upload2"
+            plain
+            :loading="isLoading"
+            >导入</el-button
+          >
+        </div>
+
         <el-button
+          v-else
           type="primary"
-          size="mini"
+          size="small"
           icon="el-icon-upload2"
           plain
           @click="uploadFile"
@@ -107,7 +139,6 @@
           结构BOM
         </el-link>
 
-
         <el-link
           type="primary"
           v-if="row.isProduct == 1"
@@ -219,7 +250,7 @@
   import goodsAllocation from './goodsAllocation.vue';
   import aridRegion from './aridRegion';
   import importDialog from '@/components/upload/import-dialog.vue';
-  import {  fieldModel } from '@/api/codeManagement';
+  import { fieldModel } from '@/api/codeManagement';
   export default {
     components: {
       importDialog,
@@ -242,7 +273,7 @@
     },
     data() {
       return {
-        moudleName : "mainCategory",
+        moudleName: 'mainCategory',
 
         errorData: [],
         exportErrorDioalogVisible: false,
@@ -333,8 +364,7 @@
             label: '分类',
             align: 'center',
             showOverflowTooltip: true
-          },
-
+          }
         ],
 
         newColumns: [],
@@ -355,7 +385,6 @@
       };
     },
 
-
     created() {
       this.getFieldModel();
     },
@@ -422,15 +451,15 @@
       getFieldModel() {
         fieldModel({ relevance: 't_main_category' }).then((res) => {
           const privateColumn = [
-          {
-            columnKey: 'action',
-            label: '操作',
-            width: 220,
-            align: 'center',
-            resizable: false,
-            slot: 'action',
-            fixed: 'right'
-          }
+            {
+              columnKey: 'action',
+              label: '操作',
+              width: 220,
+              align: 'center',
+              resizable: false,
+              slot: 'action',
+              fixed: 'right'
+            }
           ];
 
           let newRes = res.map((m) => {
@@ -523,7 +552,7 @@
         this.$refs.aridRegionRef.open(row);
       },
 
-      uploadFile () {
+      uploadFile() {
         this.$refs.importDialogRef.open();
       }
     },

+ 499 - 456
src/views/material/product/detail.vue

@@ -10,9 +10,8 @@
         <headerTitle title="基本信息">
           <el-button @click="cancel">返回</el-button>
           <el-button type="primary" @click="submit" :loading="loading"
-          >保存
-          </el-button
-          >
+            >保存
+          </el-button>
         </headerTitle>
 
         <el-row :gutter="24">
@@ -38,19 +37,19 @@
 
           <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-model="form.code" :disabled="status == 0" />
             </el-form-item>
           </el-col>
 
           <el-col :span="8">
             <el-form-item label="名称" prop="name">
-              <el-input v-model="form.name"/>
+              <el-input v-model="form.name" />
             </el-form-item>
           </el-col>
 
           <el-col :span="8">
             <el-form-item label="图号/件号" prop="imgCode">
-              <el-input v-model="form.imgCode"/>
+              <el-input v-model="form.imgCode" />
             </el-form-item>
           </el-col>
 
@@ -90,18 +89,18 @@
 
           <el-col :span="8">
             <el-form-item label="牌号" prop="brandNum">
-              <el-input v-model="form.brandNum"/>
+              <el-input v-model="form.brandNum" />
             </el-form-item>
           </el-col>
           <el-col :span="8">
             <el-form-item label="型号" prop="modelType">
-              <el-input v-model="form.modelType"/>
+              <el-input v-model="form.modelType" />
             </el-form-item>
           </el-col>
 
           <el-col :span="8">
             <el-form-item label="规格" prop="specification">
-              <el-input v-model="form.specification"/>
+              <el-input v-model="form.specification" />
             </el-form-item>
           </el-col>
 
@@ -141,7 +140,7 @@
           <el-col :span="8">
             <el-form-item label="体积">
               <div class="form-line">
-                <el-input v-model="form.volume"/>
+                <el-input v-model="form.volume" />
                 <DictSelection
                   class="line-select"
                   dictName="体积单位"
@@ -156,7 +155,7 @@
           <el-col :span="8">
             <el-form-item label="毛重">
               <div class="form-line">
-                <el-input v-model="form.roughWeight"/>
+                <el-input v-model="form.roughWeight" />
               </div>
             </el-form-item>
           </el-col>
@@ -164,7 +163,7 @@
           <el-col :span="8">
             <el-form-item label="净重">
               <div class="form-line">
-                <el-input v-model="form.netWeight"/>
+                <el-input v-model="form.netWeight" />
               </div>
             </el-form-item>
           </el-col>
@@ -193,9 +192,16 @@
             <el-form-item :label="f.label">
               <template>
                 <div class="form-line">
-                  <component :is="f.tagType" v-model="form.extField[f.prop]" :disabled="f.extAttribute?.disabled"
-                             clearable :isProhibit="f.modelType=='dict'?f.extAttribute?.disabled:false"
-                             :dictName="f.modelType=='dict'?f.label:''"></component>
+                  <component
+                    :is="f.tagType"
+                    v-model="form.extField[f.prop]"
+                    :disabled="f.extAttribute?.disabled"
+                    clearable
+                    :isProhibit="
+                      f.modelType == 'dict' ? f.extAttribute?.disabled : false
+                    "
+                    :dictName="f.modelType == 'dict' ? f.label : ''"
+                  ></component>
                 </div>
               </template>
             </el-form-item>
@@ -212,7 +218,7 @@
       @chooseCode="chooseCode"
     ></CodeDialog>
     <!-- 分类选择弹窗 -->
-    <CategoryDialog ref="categoryRefs" @chooseCategory="confirmCategory"/>
+    <CategoryDialog ref="categoryRefs" @chooseCategory="confirmCategory" />
     <!-- 仓储配置 -->
     <WarehouseInfo
       ref="warehouseRefs"
@@ -222,19 +228,19 @@
       @change="changePackagingSpecification"
     />
     <!-- 生产信息 -->
-    <ProductionInfo ref="productionRefs" :form="categoryMes"/>
+    <ProductionInfo ref="productionRefs" :form="categoryMes" />
     <!-- 计划 -->
-    <PlanInfo ref="planRefs" :form="categoryAps"/>
+    <PlanInfo ref="planRefs" :form="categoryAps" />
     <!-- 质量配置 -->
-    <QualityInfo ref="qualityRefs" :form="categoryQms"/>
+    <QualityInfo ref="qualityRefs" :form="categoryQms" />
     <!-- 舟皿信息 -->
-    <BoatInfo ref="qualityRefs" :form="categoryPallet"/>
+    <BoatInfo ref="qualityRefs" :form="categoryPallet" />
     <!-- 周转车信息 -->
-    <TurnoverInfo ref="turnoverRefs" :form="categoryVehicle"/>
+    <TurnoverInfo ref="turnoverRefs" :form="categoryVehicle" />
     <!-- 模具信息 -->
-    <MoldInfo ref="moldRefs" :form="categoryMold"/>
+    <MoldInfo ref="moldRefs" :form="categoryMold" />
     <!-- 备注信息 -->
-    <RemarkInfo ref="remarkRefs" :form="remarkform"/>
+    <RemarkInfo ref="remarkRefs" :form="remarkform" />
     <!-- 关联信息 -->
     <linkMsg
       ref="linkMsgRef"
@@ -246,485 +252,522 @@
 </template>
 
 <script>
-import GroupDialog from './components/GroupDialog.vue';
-import CodeDialog from './components/codeDialog.vue';
-import CategoryDialog from './components/CategoryDialog.vue';
-import WarehouseInfo from './components/WarehouseInfo.vue';
-import ProcureInfo from './components/ProcureInfo.vue';
-import ProductionInfo from './components/ProductionInfo.vue';
-import PlanInfo from './components/PlanInfo.vue';
-import SalesInfo from './components/SalesInfo.vue';
-import QualityInfo from './components/QualityInfo.vue';
-import BoatInfo from './components/BoatInfo.vue';
-import TurnoverInfo from './components/TurnoverInfo.vue';
-import MoldInfo from './components/MoldInfo.vue';
-import RemarkInfo from './components/RemarkInfo.vue';
-import deptSelect from '@/components/CommomSelect/dept-select.vue';
-import personSelect from '@/components/CommomSelect/person-select.vue';
-import linkMsg from './components/link-msg.vue';
-import {getDetails} from '@/api/classifyManage/itemInformation';
-import {getByCode} from '@/api/system/dictionary-data';
-import {getCode, rootCategoryCode, fieldModel} from '@/api/codeManagement';
-
-import {addMaterial} from '@/api/material/list.js';
-import {deepClone} from '@/utils/index';
-import {finishPageTab, reloadPageTab} from '@/utils/page-tab-util';
-
-export default {
-  name: 'ManageMaterial',
-  components: {
-    linkMsg,
-    GroupDialog,
-    deptSelect,
-    personSelect,
-    WarehouseInfo,
-    ProcureInfo,
-    ProductionInfo,
-    PlanInfo,
-    SalesInfo,
-    QualityInfo,
-    BoatInfo,
-    TurnoverInfo,
-    MoldInfo,
-    RemarkInfo,
-    CategoryDialog,
-    CodeDialog
-  },
-  data() {
-    return {
-      packagingSpecificationList: [],
-      loading: false,
-      levelOptions: [
-        {
-          label: '特级',
-          value: '特级'
+  import GroupDialog from './components/GroupDialog.vue';
+  import CodeDialog from './components/codeDialog.vue';
+  import CategoryDialog from './components/CategoryDialog.vue';
+  import WarehouseInfo from './components/WarehouseInfo.vue';
+  import ProcureInfo from './components/ProcureInfo.vue';
+  import ProductionInfo from './components/ProductionInfo.vue';
+  import PlanInfo from './components/PlanInfo.vue';
+  import SalesInfo from './components/SalesInfo.vue';
+  import QualityInfo from './components/QualityInfo.vue';
+  import BoatInfo from './components/BoatInfo.vue';
+  import TurnoverInfo from './components/TurnoverInfo.vue';
+  import MoldInfo from './components/MoldInfo.vue';
+  import RemarkInfo from './components/RemarkInfo.vue';
+  import deptSelect from '@/components/CommomSelect/dept-select.vue';
+  import personSelect from '@/components/CommomSelect/person-select.vue';
+  import linkMsg from './components/link-msg.vue';
+  import { getDetails } from '@/api/classifyManage/itemInformation';
+  import { getByCode } from '@/api/system/dictionary-data';
+  import { getCode, rootCategoryCode, fieldModel } from '@/api/codeManagement';
+
+  import { addMaterial } from '@/api/material/list.js';
+  import { deepClone } from '@/utils/index';
+  import { finishPageTab, reloadPageTab } from '@/utils/page-tab-util';
+
+  export default {
+    name: 'ManageMaterial',
+    components: {
+      linkMsg,
+      GroupDialog,
+      deptSelect,
+      personSelect,
+      WarehouseInfo,
+      ProcureInfo,
+      ProductionInfo,
+      PlanInfo,
+      SalesInfo,
+      QualityInfo,
+      BoatInfo,
+      TurnoverInfo,
+      MoldInfo,
+      RemarkInfo,
+      CategoryDialog,
+      CodeDialog
+    },
+    data() {
+      return {
+        packagingSpecificationList: [],
+        loading: false,
+        levelOptions: [
+          {
+            label: '特级',
+            value: '特级'
+          },
+          {
+            label: '一级',
+            value: '一级'
+          },
+          {
+            label: '二级',
+            value: '二级'
+          },
+          {
+            label: '三级',
+            value: '三级'
+          }
+        ],
+        form: {
+          categoryLevelGroupName: '',
+          categoryLevelName: '',
+          isConsumable: 1,
+
+          extField: {}
         },
-        {
-          label: '一级',
-          value: '一级'
+
+        remarkform: {
+          remarkAttach: []
         },
-        {
-          label: '二级',
-          value: '二级'
+        categoryAps: {},
+        categoryMes: {},
+        categoryMold: {},
+        categoryPallet: {},
+        categoryQms: {},
+        categoryVehicle: {},
+        categoryWms: {
+          isUnpack: 1
         },
-        {
-          label: '三级',
-          value: '三级'
-        }
-      ],
-      form: {
-        categoryLevelGroupName: '',
-        categoryLevelName: '',
-        isConsumable: 1,
+        packageDispositionVOList: [],
+        categoryLevelPathId: null,
+
+        dictList: [],
+
+        fileList: [],
+        // 表单验证规则
+        rules: {
+          categoryLevelGroupName: [
+            { required: true, message: '请选择所属物料组', trigger: 'change' }
+          ],
+          code: [{ required: true, message: '请输入编码', trigger: 'blur' }],
+          name: [{ required: true, message: '请输入名称', trigger: 'blur' }],
+          categoryLevelName: [
+            { required: true, message: '请选择所属分类', trigger: 'change' }
+          ],
+          measuringUnit: [
+            { required: true, message: '请选择计量单位', trigger: 'change' }
+          ],
+
+          weightUnit: [
+            { required: true, message: '请选择重量单位', trigger: 'change' }
+          ],
+
+          packingUnit: [
+            { required: true, message: '请选择包装单位', trigger: 'change' }
+          ],
+
+          netWeight: [
+            { required: true, message: '请输入净重', trigger: 'blur' }
+          ]
+        },
+        PathInfo: {},
+        id: null,
 
-        extField: {}
-      },
+        ruleCode: null,
+        codeShow: false,
 
-      remarkform: {
-        remarkAttach: []
-      },
-      categoryAps: {},
-      categoryMes: {},
-      categoryMold: {},
-      categoryPallet: {},
-      categoryQms: {},
-      categoryVehicle: {},
-      categoryWms: {
-        isUnpack: 1
+        status: null
+      };
+    },
+    watch: {
+      '$route.query.id': {
+        handler(id) {
+          console.log('id-------------', id);
+          if (id) {
+            this._getDetails();
+          } else {
+            this.form = {
+              categoryLevelGroupName: '',
+              categoryLevelName: '',
+              isConsumable: 1,
+
+              extField: {}
+            };
+
+            this.remarkform = {
+              remarkAttach: []
+            };
+            this.categoryAps = {};
+            this.categoryMes = {};
+            this.categoryMold = {};
+            this.categoryPallet = {};
+            this.categoryQms = {};
+            this.categoryVehicle = {};
+            this.categoryWms = {
+              isUnpack: 1
+            };
+            this.packageDispositionVOList = [];
+            this.categoryLevelPathId = null;
+
+            this.dictList = [];
+
+            this.fileList = [];
+          }
+        },
+        deep: true,
+        immediate: true
+      }
+    },
+    async created() {
+      this.getFieldModel();
+      this.status = this.$route.query.status;
+      // if (this.$route.query.id) {
+      //   this._getDetails();
+      // }
+      this.getDictList('productionType');
+    },
+    methods: {
+      changePackagingSpecification(val) {
+        this.packagingSpecificationList = val;
       },
-      packageDispositionVOList: [],
-      categoryLevelPathId: null,
-
-      dictList: [],
+      async _getDetails() {
+        const data = await getDetails(this.$route.query.id);
+        const info = deepClone(data);
 
-      fileList: [],
-      // 表单验证规则
-      rules: {
-        categoryLevelGroupName: [
-          {required: true, message: '请选择所属物料组', trigger: 'change'}
-        ],
-        code: [{required: true, message: '请输入编码', trigger: 'blur'}],
-        name: [{required: true, message: '请输入名称', trigger: 'blur'}],
-        categoryLevelName: [
-          {required: true, message: '请选择所属分类', trigger: 'change'}
-        ],
-        measuringUnit: [
-          {required: true, message: '请选择计量单位', trigger: 'change'}
-        ],
+        this.form = {
+          ...info.category
+        };
+        let productType_ = this.form.produceType;
+        if (productType_ != undefined && productType_ != null) {
+          let intproductType = [];
+          for (const [index, value] of productType_.entries()) {
+            intproductType.push(value.toString());
+          }
+          this.form.produceType = intproductType;
+        }
 
-        weightUnit: [
-          {required: true, message: '请选择重量单位', trigger: 'change'}
-        ],
+        this.categoryLevelPathId = info.category.categoryLevelPathIdParent;
+        this.judgeSet(info);
 
-        packingUnit: [
-          {required: true, message: '请选择包装单位', trigger: 'change'}
-        ],
+        if (this.status == 1) {
+          rootCategoryCode(this.categoryLevelPathId).then((res) => {
+            this.$set(this.form, 'code', res);
+          });
+        }
 
-        netWeight: [
-          {required: true, message: '请输入净重', trigger: 'blur'}
-        ]
+        this.$forceUpdate();
       },
-      PathInfo: {},
-      id: null,
-
-      ruleCode: null,
-      codeShow: false,
-
-      status: null
-    };
-  },
-  watch: {
-    '$route.query.id': {
-      handler(id) {
-        console.log('id-------------', id);
-        if (id) {
-          this._getDetails();
+      // 判断字段类型并赋值
+      judgeSet(info) {
+        console.log('info-------', info);
+        if (typeof info.categoryAps == 'string') {
+          this.categoryAps = {};
+        } else {
+          this.categoryAps = info.categoryAps;
         }
-      },
-      deep: true,
-      immediate: true
-    }
-  },
-  async created() {
-    this.getFieldModel();
-    this.status = this.$route.query.status;
-    // if (this.$route.query.id) {
-    //   this._getDetails();
-    // }
-    this.getDictList('productionType');
-  },
-  methods: {
-    changePackagingSpecification(val) {
-      this.packagingSpecificationList = val;
-    },
-    async _getDetails() {
-      const data = await getDetails(this.$route.query.id);
-      const info = deepClone(data);
-
-      this.form = {
-        ...info.category
-      };
-      let productType_ = this.form.produceType;
-      if (productType_ != undefined && productType_ != null) {
-        let intproductType = [];
-        for (const [index, value] of productType_.entries()) {
-          intproductType.push(value.toString());
+        if (typeof info.categoryMes == 'string') {
+          this.categoryMes = {};
+        } else {
+          this.categoryMes = info.categoryMes;
         }
-        this.form.produceType = intproductType;
-      }
-
-      this.categoryLevelPathId = info.category.categoryLevelPathIdParent;
-      this.judgeSet(info);
-
-      if (this.status == 1) {
-        rootCategoryCode(this.categoryLevelPathId).then((res) => {
-          this.$set(this.form, 'code', res);
-        });
-      }
-
-      this.$forceUpdate();
-    },
-    // 判断字段类型并赋值
-    judgeSet(info) {
-      console.log('info-------', 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;
-      }
-      if (typeof info.packageDispositionVOList == 'string') {
-        this.packageDispositionVOList = [];
-      } else {
-        this.packageDispositionVOList = info.packageDispositionVOList;
-        console.log(
-          'this.packageDispositionVOList---!!!----',
-          this.packageDispositionVOList
-        );
-      }
-    },
+        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;
+        }
+        if (typeof info.packageDispositionVOList == 'string') {
+          this.packageDispositionVOList = [];
+        } else {
+          this.packageDispositionVOList = info.packageDispositionVOList;
+          console.log(
+            'this.packageDispositionVOList---!!!----',
+            this.packageDispositionVOList
+          );
+        }
+      },
 
-    getFieldModel() {
-      fieldModel({relevance: 't_main_category'}).then((res) => {
-        this.fileList = res;
+      getFieldModel() {
+        fieldModel({ relevance: 't_main_category' }).then((res) => {
+          this.fileList = res;
 
-        this.fileList.forEach((f) => {
-          this.$set(this.form.extField, f.prop, ''); // 初始化动态模型属性
+          this.fileList.forEach((f) => {
+            this.$set(this.form.extField, f.prop, ''); // 初始化动态模型属性
+          });
         });
-      });
-    },
+      },
 
-    // 确定分类
-    async confirmCategory(node, title, PathInfo, ruleCode) {
-      if (this.status != 0) {
-        this.$set(this.form, 'code', null);
-      }
-      this.categoryLevelPathId = PathInfo.categoryLevelPathId.split(',')[0];
-
-      if (title == '选择产品分类') {
-        this.$set(this.form, 'productCategoryLevelName', node.name);
-        this.$set(this.form, 'productCategoryLevelId', node.id);
-      } else {
-        this.$set(this.form, 'categoryLevelName', node.name);
-        this.$set(this.form, 'categoryLevelId', node.id);
-        this.$set(this.form, 'categoryLevelPath', node.name);
-        this.$set(this.form, 'categoryLevelPathId', node.id);
-        this.PathInfo = PathInfo;
-
-        this.ruleCode = ruleCode;
-
-        if (ruleCode && ruleCode != '自定义' && this.status != 0) {
-          const code = await getCode(ruleCode);
-          this.$set(this.form, 'code', code);
+      // 确定分类
+      async confirmCategory(node, title, PathInfo, ruleCode) {
+        if (this.status != 0) {
+          this.$set(this.form, 'code', null);
         }
-      }
+        this.categoryLevelPathId = PathInfo.categoryLevelPathId.split(',')[0];
 
-      this.$forceUpdate();
-    },
+        if (title == '选择产品分类') {
+          this.$set(this.form, 'productCategoryLevelName', node.name);
+          this.$set(this.form, 'productCategoryLevelId', node.id);
+        } else {
+          this.$set(this.form, 'categoryLevelName', node.name);
+          this.$set(this.form, 'categoryLevelId', node.id);
+          this.$set(this.form, 'categoryLevelPath', node.name);
+          this.$set(this.form, 'categoryLevelPathId', node.id);
+          this.PathInfo = PathInfo;
+
+          this.ruleCode = ruleCode;
+
+          if (ruleCode && ruleCode != '自定义' && this.status != 0) {
+            const code = await getCode(ruleCode);
+            this.$set(this.form, 'code', code);
+          }
+        }
 
-    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]]
-        };
-      });
-    },
+        this.$forceUpdate();
+      },
 
-    openCategory() {
-      this.$refs.categoryRefs.open();
-    },
+      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]]
+          };
+        });
+      },
 
-    openCode() {
-      this.codeShow = true;
-    },
+      openCategory() {
+        this.$refs.categoryRefs.open();
+      },
 
-    chooseCode(code) {
-      this.$set(this.form, 'code', code);
-      this.codeShow = false;
-      this.$forceUpdate();
-    },
+      openCode() {
+        this.codeShow = true;
+      },
 
-    cancel() {
-      finishPageTab();
-      this.$router.go(-1);
-    },
+      chooseCode(code) {
+        this.$set(this.form, 'code', code);
+        this.codeShow = false;
+        this.$forceUpdate();
+      },
 
-    // 保存
-    submit() {
-      this.$refs.manageForm.validate(async (valid) => {
-        let productionValid = await this.$refs.productionRefs.getFormValid();
-        console.log(productionValid);
-        if (!valid || !productionValid) {
-          return false;
-        }
+      cancel() {
+        finishPageTab();
+        this.$router.go(-1);
+      },
 
-        let packageDispositionVOList = [];
-        if (this.packagingSpecificationList.length > 0) {
-          packageDispositionVOList = this.packagingSpecificationList.map(
-            (item) => {
-              let obj = {
-                code: item.code,
-                name: item.name
-              };
-              return [
-                {
-                  ...obj,
-                  sort: 0,
-                  status: item.status
-                },
-                {
-                  ...obj,
-                  sort: 1,
-                  packageCell: item.minPackageCell,
-                  packageUnit: item.packageUnit,
-                  conversionUnit: item.minConversionUnit
-                },
-                {
-                  ...obj,
-                  sort: 2,
-                  packageCell: item.inPackageCell,
-                  packageUnit: item.minConversionUnit,
-                  conversionUnit: item.inConversionUnit
-                },
-                {
-                  ...obj,
-                  sort: 3,
-                  packageCell: item.outPackageCell,
-                  packageUnit: item.inConversionUnit,
-                  conversionUnit: item.outConversionUnit
-                }
-              ];
-            }
-          );
-          let packagingSpecificationList =
-            this.packagingSpecificationList.filter(
-              (item) => item.status == 1
+      // 保存
+      submit() {
+        this.$refs.manageForm.validate(async (valid) => {
+          let productionValid = await this.$refs.productionRefs.getFormValid();
+          console.log(productionValid);
+          if (!valid || !productionValid) {
+            return false;
+          }
+
+          let packageDispositionVOList = [];
+          if (this.packagingSpecificationList.length > 0) {
+            packageDispositionVOList = this.packagingSpecificationList.map(
+              (item) => {
+                let obj = {
+                  code: item.code,
+                  name: item.name
+                };
+                return [
+                  {
+                    ...obj,
+                    id: item.id0,
+                    sort: 0,
+                    status: item.status,
+                    packageCell: 1,
+                    packageUnit: item.packageUnit,
+                    conversionUnit: item.packageUnit
+                  },
+                  {
+                    ...obj,
+                    id: item.id1,
+                    sort: 1,
+                    packageCell: item.minPackageCell,
+                    packageUnit: item.packageUnit,
+                    conversionUnit: item.minConversionUnit,
+                    status: item.status
+                  },
+                  {
+                    ...obj,
+                    id: item.id2,
+                    sort: 2,
+                    packageCell: item.inPackageCell,
+                    packageUnit: item.minConversionUnit,
+                    conversionUnit: item.inConversionUnit,
+                    status: item.status
+                  },
+                  {
+                    ...obj,
+                    id: item.id3,
+                    sort: 3,
+                    packageCell: item.outPackageCell,
+                    packageUnit: item.inConversionUnit,
+                    conversionUnit: item.outConversionUnit,
+                    status: item.status
+                  }
+                ];
+              }
+            );
+            let packagingSpecificationList =
+              this.packagingSpecificationList.filter(
+                (item) => item.status == 1
+              );
+            this.form.extField.packingSpecification = packagingSpecificationList
+              .map((item) => {
+                return [
+                  `${item.minPackageCell}${item.packageUnit}/${item.minConversionUnit}`,
+                  `${item.inPackageCell}${item.minConversionUnit}/${item.inConversionUnit}`,
+                  `${item.outPackageCell}${item.inConversionUnit}/${item.outConversionUnit}`
+                ];
+              })
+              .flat()
+              .join(',');
+          } else {
+            this.form.extField.packingSpecification = '';
+          }
+
+          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 data = {
+            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
+            },
+            packageDispositionVOList: packageDispositionVOList.flat()
+          };
+
+          if (this.$route.query.status == 1) {
+            data.category.id = null;
+            data.categoryWms.id = null;
+            data.categoryAps.id = null;
+            data.categoryMes.id = null;
+            data.categoryMold.id = null;
+            data.categoryPallet.id = null;
+            data.categoryQms.id = null;
+            data.categoryVehicle.id = null;
+            data.packageDispositionVOList = data.packageDispositionVOList.map(
+              (item) => {
+                return {
+                  ...item,
+                  id: null
+                };
+              }
             );
-          this.form.extField.packingSpecification = packagingSpecificationList
-            .map((item) => {
-              return [
-                `${item.minPackageCell}${item.packageUnit}/${item.minConversionUnit}`,
-                `${item.inPackageCell}${item.minConversionUnit}/${item.inConversionUnit}`,
-                `${item.outPackageCell}${item.inConversionUnit}/${item.outConversionUnit}`
-              ];
+          }
+
+          addMaterial(data)
+            .then((msg) => {
+              this.loading = false;
+              this.$message.success(msg);
+              reloadPageTab({ fullPath: '/material/product' });
+              this.$router.go(-1);
             })
-            .flat()
-            .join(',');
-        } else {
-          this.form.extField.packingSpecification = '';
-        }
-
-        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 data = {
-          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
-          },
-          packageDispositionVOList: packageDispositionVOList.flat()
-        };
-
-        if (this.$route.query.status == 1) {
-          data.category.id = null;
-          data.categoryWms.id = null;
-          data.categoryAps.id = null;
-          data.categoryMes.id = null;
-          data.categoryMold.id = null;
-          data.categoryPallet.id = null;
-          data.categoryQms.id = null;
-          data.categoryVehicle.id = null;
-          data.packageDispositionVOList = data.packageDispositionVOList.map(
-            (item) => {
-              return {
-                ...item,
-                id: null
-              };
-            }
-          );
-        }
-
-        addMaterial(data)
-          .then((msg) => {
-            this.loading = false;
-            this.$message.success(msg);
-            reloadPageTab({fullPath: '/material/product'});
-            this.$router.go(-1);
-          })
-          .catch((e) => {
-            this.loading = false;
-          });
-      });
+            .catch((e) => {
+              this.loading = false;
+            });
+        });
+      }
     }
-  }
-};
+  };
 </script>
 
 <style lang="scss" scoped>
-.ele-page-header {
-  border: none;
-}
-
-.body-top {
-  display: flex;
-  align-items: center;
-  justify-content: space-between;
-  background: #fff;
+  .ele-page-header {
+    border: none;
+  }
 
-  .top-left {
+  .body-top {
     display: flex;
     align-items: center;
-    justify-content: flex-start;
-    margin-left: -25px;
+    justify-content: space-between;
+    background: #fff;
 
-    .el-form-item {
-      margin-bottom: 0;
+    .top-left {
+      display: flex;
+      align-items: center;
+      justify-content: flex-start;
+      margin-left: -25px;
+
+      .el-form-item {
+        margin-bottom: 0;
+      }
     }
   }
-}
 
-.divider {
-  margin: 20px 0;
+  .divider {
+    margin: 20px 0;
 
-  .title {
-    display: flex;
-    align-items: center;
-    margin-bottom: 10px;
+    .title {
+      display: flex;
+      align-items: center;
+      margin-bottom: 10px;
 
-    div {
-      width: 8px;
-      height: 20px;
-      margin-right: 10px;
-    }
+      div {
+        width: 8px;
+        height: 20px;
+        margin-right: 10px;
+      }
 
-    span {
-      font-size: 20px;
+      span {
+        font-size: 20px;
+      }
     }
-  }
 
-  .ele-width {
-    width: 100%;
-    height: 2px;
+    .ele-width {
+      width: 100%;
+      height: 2px;
+    }
   }
-}
 
-.form-line {
-  display: flex;
-  align-items: center;
-  justify-content: space-between;
+  .form-line {
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
 
-  .line-select {
-    margin-left: 15px;
+    .line-select {
+      margin-left: 15px;
+    }
   }
-}
 </style>