Browse Source

修改bug

695593266@qq.com 1 year ago
parent
commit
18bdade316

+ 188 - 128
src/components/bpmnProcessDesigner/package/designer/plugins/content-pad/contentPadProvider.js

@@ -1,14 +1,14 @@
-import { assign, forEach, isArray } from "min-dash";
+import { assign, forEach, isArray } from 'min-dash';
 
-import { is } from "bpmn-js/lib/util/ModelUtil";
+import { is } from 'bpmn-js/lib/util/ModelUtil';
 
-import { isExpanded, isEventSubProcess } from "bpmn-js/lib/util/DiUtil";
+import { isExpanded, isEventSubProcess } from 'bpmn-js/lib/util/DiUtil';
 
-import { isAny } from "bpmn-js/lib/features/modeling/util/ModelingUtil";
+import { isAny } from 'bpmn-js/lib/features/modeling/util/ModelingUtil';
 
-import { getChildLanes } from "bpmn-js/lib/features/modeling/util/LaneUtil";
+import { getChildLanes } from 'bpmn-js/lib/features/modeling/util/LaneUtil';
 
-import { hasPrimaryModifier } from "diagram-js/lib/util/Mouse";
+import { hasPrimaryModifier } from 'diagram-js/lib/util/Mouse';
 
 /**
  * A provider for BPMN 2.0 elements context pad
@@ -45,18 +45,18 @@ export default function ContextPadProvider(
   this._translate = translate;
 
   if (config.autoPlace !== false) {
-    this._autoPlace = injector.get("autoPlace", false);
+    this._autoPlace = injector.get('autoPlace', false);
   }
 
-  eventBus.on("create.end", 250, function(event) {
+  eventBus.on('create.end', 250, function (event) {
     const context = event.context,
-      shape = context.shape
+      shape = context.shape;
 
     if (!hasPrimaryModifier(event) || !contextPad.isOpen(shape)) {
       return;
     }
 
-    const entries = contextPad.getEntries(shape)
+    const entries = contextPad.getEntries(shape);
 
     if (entries.replace) {
       entries.replace.action.click(event, shape);
@@ -65,22 +65,22 @@ export default function ContextPadProvider(
 }
 
 ContextPadProvider.$inject = [
-  "config.contextPad",
-  "injector",
-  "eventBus",
-  "contextPad",
-  "modeling",
-  "elementFactory",
-  "connect",
-  "create",
-  "popupMenu",
-  "canvas",
-  "rules",
-  "translate",
-  "elementRegistry"
+  'config.contextPad',
+  'injector',
+  'eventBus',
+  'contextPad',
+  'modeling',
+  'elementFactory',
+  'connect',
+  'create',
+  'popupMenu',
+  'canvas',
+  'rules',
+  'translate',
+  'elementRegistry'
 ];
 
-ContextPadProvider.prototype.getContextPadEntries = function(element) {
+ContextPadProvider.prototype.getContextPadEntries = function (element) {
   const contextPad = this._contextPad,
     modeling = this._modeling,
     elementFactory = this._elementFactory,
@@ -90,15 +90,15 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
     canvas = this._canvas,
     rules = this._rules,
     autoPlace = this._autoPlace,
-    translate = this._translate
+    translate = this._translate;
 
-  const actions = {}
+  const actions = {};
 
-  if (element.type === "label") {
+  if (element.type === 'label') {
     return actions;
   }
 
-  const businessObject = element.businessObject
+  const businessObject = element.businessObject;
 
   function startConnect(event, element) {
     connect.start(event, element);
@@ -109,21 +109,21 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
   }
 
   function getReplaceMenuPosition(element) {
-    const Y_OFFSET = 5
+    const Y_OFFSET = 5;
 
     const diagramContainer = canvas.getContainer(),
-      pad = contextPad.getPad(element).html
+      pad = contextPad.getPad(element).html;
 
     const diagramRect = diagramContainer.getBoundingClientRect(),
-      padRect = pad.getBoundingClientRect()
+      padRect = pad.getBoundingClientRect();
 
-    const top = padRect.top - diagramRect.top
-    const left = padRect.left - diagramRect.left
+    const top = padRect.top - diagramRect.top;
+    const left = padRect.left - diagramRect.left;
 
     const pos = {
       x: left,
       y: top + padRect.height + Y_OFFSET
-    }
+    };
 
     return pos;
   }
@@ -139,28 +139,30 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
    * @return {Object} descriptor
    */
   function appendAction(type, className, title, options) {
-    if (typeof title !== "string") {
+    if (typeof title !== 'string') {
       options = title;
-      title = translate("Append {type}", { type: type.replace(/^bpmn:/, "") });
+      title = translate('Append {type}', { type: type.replace(/^bpmn:/, '') });
     }
 
     function appendStart(event, element) {
-      const shape = elementFactory.createShape(assign({ type: type }, options))
+      const shape = elementFactory.createShape(assign({ type: type }, options));
       create.start(event, shape, {
         source: element
       });
     }
 
     const append = autoPlace
-      ? function(event, element) {
-        const shape = elementFactory.createShape(assign({ type: type }, options))
+      ? function (event, element) {
+          const shape = elementFactory.createShape(
+            assign({ type: type }, options)
+          );
 
-        autoPlace.append(element, shape)
-      }
-      : appendStart
+          autoPlace.append(element, shape);
+        }
+      : appendStart;
 
     return {
-      group: "model",
+      group: 'model',
       className: className,
       title: title,
       action: {
@@ -171,7 +173,7 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
   }
 
   function splitLaneHandler(count) {
-    return function(event, element) {
+    return function (event, element) {
       // actual split
       modeling.splitLane(element, count);
 
@@ -181,17 +183,20 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
     };
   }
 
-  if (isAny(businessObject, ["bpmn:Lane", "bpmn:Participant"]) && isExpanded(businessObject)) {
-    const childLanes = getChildLanes(element)
+  if (
+    isAny(businessObject, ['bpmn:Lane', 'bpmn:Participant']) &&
+    isExpanded(businessObject)
+  ) {
+    const childLanes = getChildLanes(element);
 
     assign(actions, {
-      "lane-insert-above": {
-        group: "lane-insert-above",
-        className: "bpmn-icon-lane-insert-above",
-        title: translate("Add Lane above"),
+      'lane-insert-above': {
+        group: 'lane-insert-above',
+        className: 'bpmn-icon-lane-insert-above',
+        title: translate('Add Lane above'),
         action: {
-          click: function(event, element) {
-            modeling.addLane(element, "top");
+          click: function (event, element) {
+            modeling.addLane(element, 'top');
           }
         }
       }
@@ -200,10 +205,10 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
     if (childLanes.length < 2) {
       if (element.height >= 120) {
         assign(actions, {
-          "lane-divide-two": {
-            group: "lane-divide",
-            className: "bpmn-icon-lane-divide-two",
-            title: translate("Divide into two Lanes"),
+          'lane-divide-two': {
+            group: 'lane-divide',
+            className: 'bpmn-icon-lane-divide-two',
+            title: translate('Divide into two Lanes'),
             action: {
               click: splitLaneHandler(2)
             }
@@ -213,10 +218,10 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
 
       if (element.height >= 180) {
         assign(actions, {
-          "lane-divide-three": {
-            group: "lane-divide",
-            className: "bpmn-icon-lane-divide-three",
-            title: translate("Divide into three Lanes"),
+          'lane-divide-three': {
+            group: 'lane-divide',
+            className: 'bpmn-icon-lane-divide-three',
+            title: translate('Divide into three Lanes'),
             action: {
               click: splitLaneHandler(3)
             }
@@ -226,101 +231,148 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
     }
 
     assign(actions, {
-      "lane-insert-below": {
-        group: "lane-insert-below",
-        className: "bpmn-icon-lane-insert-below",
-        title: translate("Add Lane below"),
+      'lane-insert-below': {
+        group: 'lane-insert-below',
+        className: 'bpmn-icon-lane-insert-below',
+        title: translate('Add Lane below'),
         action: {
-          click: function(event, element) {
-            modeling.addLane(element, "bottom");
+          click: function (event, element) {
+            modeling.addLane(element, 'bottom');
           }
         }
       }
     });
   }
 
-  if (is(businessObject, "bpmn:FlowNode")) {
-    if (is(businessObject, "bpmn:EventBasedGateway")) {
+  if (is(businessObject, 'bpmn:FlowNode')) {
+    if (is(businessObject, 'bpmn:EventBasedGateway')) {
       assign(actions, {
-        "append.receive-task": appendAction("bpmn:ReceiveTask", "bpmn-icon-receive-task", translate("Append ReceiveTask")),
-        "append.message-intermediate-event": appendAction(
-          "bpmn:IntermediateCatchEvent",
-          "bpmn-icon-intermediate-event-catch-message",
-          translate("Append MessageIntermediateCatchEvent"),
-          { eventDefinitionType: "bpmn:MessageEventDefinition" }
+        'append.receive-task': appendAction(
+          'bpmn:ReceiveTask',
+          'bpmn-icon-receive-task',
+          translate('Append ReceiveTask')
         ),
-        "append.timer-intermediate-event": appendAction(
-          "bpmn:IntermediateCatchEvent",
-          "bpmn-icon-intermediate-event-catch-timer",
-          translate("Append TimerIntermediateCatchEvent"),
-          { eventDefinitionType: "bpmn:TimerEventDefinition" }
+        'append.message-intermediate-event': appendAction(
+          'bpmn:IntermediateCatchEvent',
+          'bpmn-icon-intermediate-event-catch-message',
+          translate('Append MessageIntermediateCatchEvent'),
+          { eventDefinitionType: 'bpmn:MessageEventDefinition' }
         ),
-        "append.condition-intermediate-event": appendAction(
-          "bpmn:IntermediateCatchEvent",
-          "bpmn-icon-intermediate-event-catch-condition",
-          translate("Append ConditionIntermediateCatchEvent"),
-          { eventDefinitionType: "bpmn:ConditionalEventDefinition" }
+        'append.timer-intermediate-event': appendAction(
+          'bpmn:IntermediateCatchEvent',
+          'bpmn-icon-intermediate-event-catch-timer',
+          translate('Append TimerIntermediateCatchEvent'),
+          { eventDefinitionType: 'bpmn:TimerEventDefinition' }
         ),
-        "append.signal-intermediate-event": appendAction(
-          "bpmn:IntermediateCatchEvent",
-          "bpmn-icon-intermediate-event-catch-signal",
-          translate("Append SignalIntermediateCatchEvent"),
-          { eventDefinitionType: "bpmn:SignalEventDefinition" }
+        'append.condition-intermediate-event': appendAction(
+          'bpmn:IntermediateCatchEvent',
+          'bpmn-icon-intermediate-event-catch-condition',
+          translate('Append ConditionIntermediateCatchEvent'),
+          { eventDefinitionType: 'bpmn:ConditionalEventDefinition' }
+        ),
+        'append.signal-intermediate-event': appendAction(
+          'bpmn:IntermediateCatchEvent',
+          'bpmn-icon-intermediate-event-catch-signal',
+          translate('Append SignalIntermediateCatchEvent'),
+          { eventDefinitionType: 'bpmn:SignalEventDefinition' }
         )
       });
-    } else if (isEventType(businessObject, "bpmn:BoundaryEvent", "bpmn:CompensateEventDefinition")) {
+    } else if (
+      isEventType(
+        businessObject,
+        'bpmn:BoundaryEvent',
+        'bpmn:CompensateEventDefinition'
+      )
+    ) {
       assign(actions, {
-        "append.compensation-activity": appendAction("bpmn:Task", "bpmn-icon-task", translate("Append compensation activity"), {
-          isForCompensation: true
-        })
+        'append.compensation-activity': appendAction(
+          'bpmn:Task',
+          'bpmn-icon-task',
+          translate('Append compensation activity'),
+          {
+            isForCompensation: true
+          }
+        )
       });
     } else if (
-      !is(businessObject, "bpmn:EndEvent") &&
+      !is(businessObject, 'bpmn:EndEvent') &&
       !businessObject.isForCompensation &&
-      !isEventType(businessObject, "bpmn:IntermediateThrowEvent", "bpmn:LinkEventDefinition") &&
+      !isEventType(
+        businessObject,
+        'bpmn:IntermediateThrowEvent',
+        'bpmn:LinkEventDefinition'
+      ) &&
       !isEventSubProcess(businessObject)
     ) {
       assign(actions, {
-        "append.end-event": appendAction("bpmn:EndEvent", "bpmn-icon-end-event-none", translate("Append EndEvent")),
-        "append.gateway": appendAction("bpmn:ExclusiveGateway", "bpmn-icon-gateway-none", translate("Append Gateway")),
-        "append.append-task": appendAction("bpmn:UserTask", "bpmn-icon-user-task", translate("Append Task")),
-        "append.intermediate-event": appendAction(
-          "bpmn:IntermediateThrowEvent",
-          "bpmn-icon-intermediate-event-none",
-          translate("Append Intermediate/Boundary Event")
+        'append.end-event': appendAction(
+          'bpmn:EndEvent',
+          'bpmn-icon-end-event-none',
+          translate('Append EndEvent')
+        ),
+        'append.gateway': appendAction(
+          'bpmn:ExclusiveGateway',
+          'bpmn-icon-gateway-none',
+          translate('Append Gateway')
+        ),
+        'append.append-task': appendAction(
+          'bpmn:UserTask',
+          'bpmn-icon-user-task',
+          translate('Append Task')
+        ),
+        'append.intermediate-event': appendAction(
+          'bpmn:IntermediateThrowEvent',
+          'bpmn-icon-intermediate-event-none',
+          translate('Append Intermediate/Boundary Event')
         )
       });
     }
   }
 
-  if (!popupMenu.isEmpty(element, "bpmn-replace")) {
+  if (!popupMenu.isEmpty(element, 'bpmn-replace')) {
     // Replace menu entry
     assign(actions, {
       replace: {
-        group: "edit",
-        className: "bpmn-icon-screw-wrench",
-        title: translate("Change type"),
+        group: 'edit',
+        className: 'bpmn-icon-screw-wrench',
+        title: translate('Change type'),
         action: {
-          click: function(event, element) {
+          click: function (event, element) {
             const position = assign(getReplaceMenuPosition(element), {
               cursor: { x: event.x, y: event.y }
-            })
+            });
 
-            popupMenu.open(element, "bpmn-replace", position);
+            popupMenu.open(element, 'bpmn-replace', position);
           }
         }
       }
     });
   }
 
-  if (isAny(businessObject, ["bpmn:FlowNode", "bpmn:InteractionNode", "bpmn:DataObjectReference", "bpmn:DataStoreReference"])) {
+  if (
+    isAny(businessObject, [
+      'bpmn:FlowNode',
+      'bpmn:InteractionNode',
+      'bpmn:DataObjectReference',
+      'bpmn:DataStoreReference'
+    ])
+  ) {
     assign(actions, {
-      "append.text-annotation": appendAction("bpmn:TextAnnotation", "bpmn-icon-text-annotation"),
+      'append.text-annotation': appendAction(
+        'bpmn:TextAnnotation',
+        'bpmn-icon-text-annotation'
+      ),
 
       connect: {
-        group: "connect",
-        className: "bpmn-icon-connection-multi",
-        title: translate("Connect using " + (businessObject.isForCompensation ? "" : "Sequence/MessageFlow or ") + "Association"),
+        group: 'connect',
+        className: 'bpmn-icon-connection-multi',
+        title: translate(
+          'Connect using ' +
+            (businessObject.isForCompensation
+              ? ''
+              : 'Sequence/MessageFlow or ') +
+            'Association'
+        ),
         action: {
           click: startConnect,
           dragstart: startConnect
@@ -329,12 +381,17 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
     });
   }
 
-  if (isAny(businessObject, ["bpmn:DataObjectReference", "bpmn:DataStoreReference"])) {
+  if (
+    isAny(businessObject, [
+      'bpmn:DataObjectReference',
+      'bpmn:DataStoreReference'
+    ])
+  ) {
     assign(actions, {
       connect: {
-        group: "connect",
-        className: "bpmn-icon-connection-multi",
-        title: translate("Connect using DataInputAssociation"),
+        group: 'connect',
+        className: 'bpmn-icon-connection-multi',
+        title: translate('Connect using DataInputAssociation'),
         action: {
           click: startConnect,
           dragstart: startConnect
@@ -343,14 +400,17 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
     });
   }
 
-  if (is(businessObject, "bpmn:Group")) {
+  if (is(businessObject, 'bpmn:Group')) {
     assign(actions, {
-      "append.text-annotation": appendAction("bpmn:TextAnnotation", "bpmn-icon-text-annotation")
+      'append.text-annotation': appendAction(
+        'bpmn:TextAnnotation',
+        'bpmn-icon-text-annotation'
+      )
     });
   }
 
   // delete element entry, only show if allowed by rules
-  let deleteAllowed = rules.allowed('elements.delete', { elements: [element] })
+  let deleteAllowed = rules.allowed('elements.delete', { elements: [element] });
 
   if (isArray(deleteAllowed)) {
     // was the element returned as a deletion candidate?
@@ -360,9 +420,9 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
   if (deleteAllowed) {
     assign(actions, {
       delete: {
-        group: "edit",
-        className: "bpmn-icon-trash",
-        title: translate("Remove"),
+        group: 'edit',
+        className: 'bpmn-icon-trash',
+        title: translate('Remove'),
         action: {
           click: removeElement
         }
@@ -376,11 +436,11 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
 // helpers /////////
 
 function isEventType(eventBo, type, definition) {
-  const isType = eventBo.$instanceOf(type)
-  let isDefinition = false
+  const isType = eventBo.$instanceOf(type);
+  let isDefinition = false;
 
-  const definitions = eventBo.eventDefinitions || []
-  forEach(definitions, function(def) {
+  const definitions = eventBo.eventDefinitions || [];
+  forEach(definitions, function (def) {
     if (def.$type === definition) {
       isDefinition = true;
     }

+ 326 - 151
src/components/bpmnProcessDesigner/package/penal/listeners/ElementListeners.vue

@@ -3,31 +3,78 @@
     <el-table :data="elementListenersList" size="mini" border>
       <el-table-column label="序号" width="50px" type="index" />
       <el-table-column label="事件类型" min-width="100px" prop="event" />
-      <el-table-column label="监听器类型" min-width="100px" show-overflow-tooltip :formatter="row => listenerTypeObject[row.listenerType]" />
+      <el-table-column
+        label="监听器类型"
+        min-width="100px"
+        show-overflow-tooltip
+        :formatter="(row) => listenerTypeObject[row.listenerType]"
+      />
       <el-table-column label="操作" width="90px">
         <template v-slot="{ row, $index }">
-          <el-button size="mini" type="text" @click="openListenerForm(row, $index)">编辑</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            @click="openListenerForm(row, $index)"
+            >编辑</el-button
+          >
           <el-divider direction="vertical" />
-          <el-button size="mini" type="text" style="color: #ff4d4f" @click="removeListener(row, $index)">移除</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            style="color: #ff4d4f"
+            @click="removeListener(row, $index)"
+            >移除</el-button
+          >
         </template>
       </el-table-column>
     </el-table>
     <div class="element-drawer__button">
-      <el-button size="mini" type="primary" icon="el-icon-plus" @click="openListenerForm(null)">添加监听器</el-button>
+      <el-button
+        size="mini"
+        type="primary"
+        icon="el-icon-plus"
+        @click="openListenerForm(null)"
+        >添加监听器</el-button
+      >
     </div>
 
     <!-- 监听器 编辑/创建 部分 -->
-    <el-drawer :visible.sync="listenerFormModelVisible" title="执行监听器" :size="`${width}px`" append-to-body destroy-on-close>
-      <el-form size="mini" :model="listenerForm" label-width="96px" ref="listenerFormRef" @submit.native.prevent>
-        <el-form-item label="事件类型" prop="event" :rules="{ required: true, trigger: ['blur', 'change'] }">
+    <el-drawer
+      :visible.sync="listenerFormModelVisible"
+      title="执行监听器"
+      :size="`${width}px`"
+      append-to-body
+      destroy-on-close
+    >
+      <el-form
+        size="mini"
+        :model="listenerForm"
+        label-width="96px"
+        ref="listenerFormRef"
+        @submit.native.prevent
+      >
+        <el-form-item
+          label="事件类型"
+          prop="event"
+          :rules="{ required: true, trigger: ['blur', 'change'] }"
+        >
           <el-select v-model="listenerForm.event">
             <el-option label="start" value="start" />
             <el-option label="end" value="end" />
           </el-select>
         </el-form-item>
-        <el-form-item label="监听器类型" prop="listenerType" :rules="{ required: true, trigger: ['blur', 'change'] }">
+        <el-form-item
+          label="监听器类型"
+          prop="listenerType"
+          :rules="{ required: true, trigger: ['blur', 'change'] }"
+        >
           <el-select v-model="listenerForm.listenerType">
-            <el-option v-for="i in Object.keys(listenerTypeObject)" :key="i" :label="listenerTypeObject[i]" :value="i" />
+            <el-option
+              v-for="i in Object.keys(listenerTypeObject)"
+              :key="i"
+              :label="listenerTypeObject[i]"
+              :value="i"
+            />
           </el-select>
         </el-form-item>
         <el-form-item
@@ -62,7 +109,11 @@
             label="脚本格式"
             prop="scriptFormat"
             key="listener-script-format"
-            :rules="{ required: true, trigger: ['blur', 'change'], message: '请填写脚本格式' }"
+            :rules="{
+              required: true,
+              trigger: ['blur', 'change'],
+              message: '请填写脚本格式'
+            }"
           >
             <el-input v-model="listenerForm.scriptFormat" clearable />
           </el-form-item>
@@ -70,7 +121,11 @@
             label="脚本类型"
             prop="scriptType"
             key="listener-script-type"
-            :rules="{ required: true, trigger: ['blur', 'change'], message: '请选择脚本类型' }"
+            :rules="{
+              required: true,
+              trigger: ['blur', 'change'],
+              message: '请选择脚本类型'
+            }"
           >
             <el-select v-model="listenerForm.scriptType">
               <el-option label="内联脚本" value="inlineScript" />
@@ -82,7 +137,11 @@
             label="脚本内容"
             prop="value"
             key="listener-script"
-            :rules="{ required: true, trigger: ['blur', 'change'], message: '请填写脚本内容' }"
+            :rules="{
+              required: true,
+              trigger: ['blur', 'change'],
+              message: '请填写脚本内容'
+            }"
           >
             <el-input v-model="listenerForm.value" clearable />
           </el-form-item>
@@ -91,7 +150,11 @@
             label="资源地址"
             prop="resource"
             key="listener-resource"
-            :rules="{ required: true, trigger: ['blur', 'change'], message: '请填写资源地址' }"
+            :rules="{
+              required: true,
+              trigger: ['blur', 'change'],
+              message: '请填写资源地址'
+            }"
           >
             <el-input v-model="listenerForm.resource" clearable />
           </el-form-item>
@@ -100,37 +163,100 @@
       <el-divider />
       <p class="listener-filed__title">
         <span><i class="el-icon-menu"></i>注入字段:</span>
-        <el-button size="mini" type="primary" @click="openListenerFieldForm(null)">添加字段</el-button>
+        <el-button
+          size="mini"
+          type="primary"
+          @click="openListenerFieldForm(null)"
+          >添加字段</el-button
+        >
       </p>
-      <el-table :data="fieldsListOfListener" size="mini" max-height="240" border fit style="flex: none">
+      <el-table
+        :data="fieldsListOfListener"
+        size="mini"
+        max-height="240"
+        border
+        fit
+        style="flex: none"
+      >
         <el-table-column label="序号" width="50px" type="index" />
         <el-table-column label="字段名称" min-width="100px" prop="name" />
-        <el-table-column label="字段类型" min-width="80px" show-overflow-tooltip :formatter="row => fieldTypeObject[row.fieldType]" />
-        <el-table-column label="字段值/表达式" min-width="100px" show-overflow-tooltip :formatter="row => row.string || row.expression" />
+        <el-table-column
+          label="字段类型"
+          min-width="80px"
+          show-overflow-tooltip
+          :formatter="(row) => fieldTypeObject[row.fieldType]"
+        />
+        <el-table-column
+          label="字段值/表达式"
+          min-width="100px"
+          show-overflow-tooltip
+          :formatter="(row) => row.string || row.expression"
+        />
         <el-table-column label="操作" width="100px">
           <template v-slot="{ row, $index }">
-            <el-button size="mini" type="text" @click="openListenerFieldForm(row, $index)">编辑</el-button>
+            <el-button
+              size="mini"
+              type="text"
+              @click="openListenerFieldForm(row, $index)"
+              >编辑</el-button
+            >
             <el-divider direction="vertical" />
-            <el-button size="mini" type="text" style="color: #ff4d4f" @click="removeListenerField(row, $index)">移除</el-button>
+            <el-button
+              size="mini"
+              type="text"
+              style="color: #ff4d4f"
+              @click="removeListenerField(row, $index)"
+              >移除</el-button
+            >
           </template>
         </el-table-column>
       </el-table>
 
       <div class="element-drawer__button">
-        <el-button size="mini" @click="listenerFormModelVisible = false">取 消</el-button>
-        <el-button size="mini" type="primary" @click="saveListenerConfig">保 存</el-button>
+        <el-button size="mini" @click="listenerFormModelVisible = false"
+          >取 消</el-button
+        >
+        <el-button size="mini" type="primary" @click="saveListenerConfig"
+          >保 存</el-button
+        >
       </div>
     </el-drawer>
 
     <!-- 注入西段 编辑/创建 部分 -->
-    <el-dialog title="字段配置" :visible.sync="listenerFieldFormModelVisible" width="600px" append-to-body destroy-on-close>
-      <el-form :model="listenerFieldForm" size="mini" label-width="96px" ref="listenerFieldFormRef" style="height: 136px" @submit.native.prevent>
-        <el-form-item label="字段名称:" prop="name" :rules="{ required: true, trigger: ['blur', 'change'] }">
+    <el-dialog
+      title="字段配置"
+      :visible.sync="listenerFieldFormModelVisible"
+      width="600px"
+      append-to-body
+      destroy-on-close
+    >
+      <el-form
+        :model="listenerFieldForm"
+        size="mini"
+        label-width="96px"
+        ref="listenerFieldFormRef"
+        style="height: 136px"
+        @submit.native.prevent
+      >
+        <el-form-item
+          label="字段名称:"
+          prop="name"
+          :rules="{ required: true, trigger: ['blur', 'change'] }"
+        >
           <el-input v-model="listenerFieldForm.name" clearable />
         </el-form-item>
-        <el-form-item label="字段类型:" prop="fieldType" :rules="{ required: true, trigger: ['blur', 'change'] }">
+        <el-form-item
+          label="字段类型:"
+          prop="fieldType"
+          :rules="{ required: true, trigger: ['blur', 'change'] }"
+        >
           <el-select v-model="listenerFieldForm.fieldType">
-            <el-option v-for="i in Object.keys(fieldTypeObject)" :key="i" :label="fieldTypeObject[i]" :value="i" />
+            <el-option
+              v-for="i in Object.keys(fieldTypeObject)"
+              :key="i"
+              :label="fieldTypeObject[i]"
+              :value="i"
+            />
           </el-select>
         </el-form-item>
         <el-form-item
@@ -153,144 +279,193 @@
         </el-form-item>
       </el-form>
       <template slot="footer">
-        <el-button size="mini" @click="listenerFieldFormModelVisible = false">取 消</el-button>
-        <el-button size="mini" type="primary" @click="saveListenerFiled">确 定</el-button>
+        <el-button size="mini" @click="listenerFieldFormModelVisible = false"
+          >取 消</el-button
+        >
+        <el-button size="mini" type="primary" @click="saveListenerFiled"
+          >确 定</el-button
+        >
       </template>
     </el-dialog>
   </div>
 </template>
 <script>
-import { createListenerObject, updateElementExtensions } from "../../utils";
-import { initListenerType, initListenerForm, listenerType, fieldType } from "./utilSelf";
+  import { createListenerObject, updateElementExtensions } from '../../utils';
+  import {
+    initListenerType,
+    initListenerForm,
+    listenerType,
+    fieldType
+  } from './utilSelf';
 
-export default {
-  name: "ElementListeners",
-  props: {
-    id: String,
-    type: String
-  },
-  inject: {
-    prefix: "prefix",
-    width: "width"
-  },
-  data() {
-    return {
-      elementListenersList: [], // 监听器列表
-      listenerForm: {}, // 监听器详情表单
-      listenerFormModelVisible: false, // 监听器 编辑 侧边栏显示状态
-      fieldsListOfListener: [],
-      listenerFieldForm: {}, // 监听器 注入字段 详情表单
-      listenerFieldFormModelVisible: false, // 监听器 注入字段表单弹窗 显示状态
-      editingListenerIndex: -1, // 监听器所在下标,-1 为新增
-      editingListenerFieldIndex: -1, // 字段所在下标,-1 为新增
-      listenerTypeObject: listenerType,
-      fieldTypeObject: fieldType
-    };
-  },
-  watch: {
-    id: {
-      immediate: true,
-      handler(val) {
-        val && val.length && this.$nextTick(() => this.resetListenersList());
-      }
-    }
-  },
-  methods: {
-    resetListenersList() {
-      this.bpmnElement = window.bpmnInstances.bpmnElement;
-      this.otherExtensionList = [];
-      this.bpmnElementListeners =
-        this.bpmnElement.businessObject?.extensionElements?.values?.filter(ex => ex.$type === `${this.prefix}:ExecutionListener`) ?? [];
-      this.elementListenersList = this.bpmnElementListeners.map(listener => initListenerType(listener));
+  export default {
+    name: 'ElementListeners',
+    props: {
+      id: String,
+      type: String
     },
-    // 打开 监听器详情 侧边栏
-    openListenerForm(listener, index) {
-      if (listener) {
-        this.listenerForm = initListenerForm(listener);
-        this.editingListenerIndex = index;
-      } else {
-        this.listenerForm = {};
-        this.editingListenerIndex = -1; // 标记为新增
-      }
-      if (listener && listener.fields) {
-        this.fieldsListOfListener = listener.fields.map(field => ({ ...field, fieldType: field.string ? "string" : "expression" }));
-      } else {
-        this.fieldsListOfListener = [];
-        this.$set(this.listenerForm, "fields", []);
-      }
-      // 打开侧边栏并清楚验证状态
-      this.listenerFormModelVisible = true;
-      this.$nextTick(() => {
-        if (this.$refs["listenerFormRef"]) this.$refs["listenerFormRef"].clearValidate();
-      });
+    inject: {
+      prefix: 'prefix',
+      width: 'width'
     },
-    // 打开监听器字段编辑弹窗
-    openListenerFieldForm(field, index) {
-      this.listenerFieldForm = field ? JSON.parse(JSON.stringify(field)) : {};
-      this.editingListenerFieldIndex = field ? index : -1;
-      this.listenerFieldFormModelVisible = true;
-      this.$nextTick(() => {
-        if (this.$refs["listenerFieldFormRef"]) this.$refs["listenerFieldFormRef"].clearValidate();
-      });
+    data() {
+      return {
+        elementListenersList: [], // 监听器列表
+        listenerForm: {}, // 监听器详情表单
+        listenerFormModelVisible: false, // 监听器 编辑 侧边栏显示状态
+        fieldsListOfListener: [],
+        listenerFieldForm: {}, // 监听器 注入字段 详情表单
+        listenerFieldFormModelVisible: false, // 监听器 注入字段表单弹窗 显示状态
+        editingListenerIndex: -1, // 监听器所在下标,-1 为新增
+        editingListenerFieldIndex: -1, // 字段所在下标,-1 为新增
+        listenerTypeObject: listenerType,
+        fieldTypeObject: fieldType
+      };
     },
-    // 保存监听器注入字段
-    async saveListenerFiled() {
-      let validateStatus = await this.$refs["listenerFieldFormRef"].validate();
-      if (!validateStatus) return; // 验证不通过直接返回
-      if (this.editingListenerFieldIndex === -1) {
-        this.fieldsListOfListener.push(this.listenerFieldForm);
-        this.listenerForm.fields.push(this.listenerFieldForm);
-      } else {
-        this.fieldsListOfListener.splice(this.editingListenerFieldIndex, 1, this.listenerFieldForm);
-        this.listenerForm.fields.splice(this.editingListenerFieldIndex, 1, this.listenerFieldForm);
+    watch: {
+      id: {
+        immediate: true,
+        handler(val) {
+          val && val.length && this.$nextTick(() => this.resetListenersList());
+        }
       }
-      this.listenerFieldFormModelVisible = false;
-      this.$nextTick(() => (this.listenerFieldForm = {}));
     },
-    // 移除监听器字段
-    removeListenerField(field, index) {
-      this.$confirm("确认移除该字段吗?", "提示", {
-        confirmButtonText: "确 认",
-        cancelButtonText: "取 消"
-      })
-        .then(() => {
-          this.fieldsListOfListener.splice(index, 1);
-          this.listenerForm.fields.splice(index, 1);
+    methods: {
+      resetListenersList() {
+        this.bpmnElement = window.bpmnInstances.bpmnElement;
+        this.otherExtensionList = [];
+        this.bpmnElementListeners =
+          this.bpmnElement.businessObject?.extensionElements?.values?.filter(
+            (ex) => ex.$type === `${this.prefix}:ExecutionListener`
+          ) ?? [];
+        this.elementListenersList = this.bpmnElementListeners.map((listener) =>
+          initListenerType(listener)
+        );
+      },
+      // 打开 监听器详情 侧边栏
+      openListenerForm(listener, index) {
+        if (listener) {
+          this.listenerForm = initListenerForm(listener);
+          this.editingListenerIndex = index;
+        } else {
+          this.listenerForm = {};
+          this.editingListenerIndex = -1; // 标记为新增
+        }
+        if (listener && listener.fields) {
+          this.fieldsListOfListener = listener.fields.map((field) => ({
+            ...field,
+            fieldType: field.string ? 'string' : 'expression'
+          }));
+        } else {
+          this.fieldsListOfListener = [];
+          this.$set(this.listenerForm, 'fields', []);
+        }
+        // 打开侧边栏并清楚验证状态
+        this.listenerFormModelVisible = true;
+        this.$nextTick(() => {
+          if (this.$refs['listenerFormRef'])
+            this.$refs['listenerFormRef'].clearValidate();
+        });
+      },
+      // 打开监听器字段编辑弹窗
+      openListenerFieldForm(field, index) {
+        this.listenerFieldForm = field ? JSON.parse(JSON.stringify(field)) : {};
+        this.editingListenerFieldIndex = field ? index : -1;
+        this.listenerFieldFormModelVisible = true;
+        this.$nextTick(() => {
+          if (this.$refs['listenerFieldFormRef'])
+            this.$refs['listenerFieldFormRef'].clearValidate();
+        });
+      },
+      // 保存监听器注入字段
+      async saveListenerFiled() {
+        let validateStatus = await this.$refs[
+          'listenerFieldFormRef'
+        ].validate();
+        if (!validateStatus) return; // 验证不通过直接返回
+        if (this.editingListenerFieldIndex === -1) {
+          this.fieldsListOfListener.push(this.listenerFieldForm);
+          this.listenerForm.fields.push(this.listenerFieldForm);
+        } else {
+          this.fieldsListOfListener.splice(
+            this.editingListenerFieldIndex,
+            1,
+            this.listenerFieldForm
+          );
+          this.listenerForm.fields.splice(
+            this.editingListenerFieldIndex,
+            1,
+            this.listenerFieldForm
+          );
+        }
+        this.listenerFieldFormModelVisible = false;
+        this.$nextTick(() => (this.listenerFieldForm = {}));
+      },
+      // 移除监听器字段
+      removeListenerField(field, index) {
+        this.$confirm('确认移除该字段吗?', '提示', {
+          confirmButtonText: '确 认',
+          cancelButtonText: '取 消'
         })
-        .catch(() => console.info("操作取消"));
-    },
-    // 移除监听器
-    removeListener(listener, index) {
-      this.$confirm("确认移除该监听器吗?", "提示", {
-        confirmButtonText: "确 认",
-        cancelButtonText: "取 消"
-      })
-        .then(() => {
-          this.bpmnElementListeners.splice(index, 1);
-          this.elementListenersList.splice(index, 1);
-          updateElementExtensions(this.bpmnElement, this.otherExtensionList.concat(this.bpmnElementListeners));
+          .then(() => {
+            this.fieldsListOfListener.splice(index, 1);
+            this.listenerForm.fields.splice(index, 1);
+          })
+          .catch(() => console.info('操作取消'));
+      },
+      // 移除监听器
+      removeListener(listener, index) {
+        this.$confirm('确认移除该监听器吗?', '提示', {
+          confirmButtonText: '确 认',
+          cancelButtonText: '取 消'
         })
-        .catch(() => console.info("操作取消"));
-    },
-    // 保存监听器配置
-    async saveListenerConfig() {
-      let validateStatus = await this.$refs["listenerFormRef"].validate();
-      if (!validateStatus) return; // 验证不通过直接返回
-      const listenerObject = createListenerObject(this.listenerForm, false, this.prefix);
-      if (this.editingListenerIndex === -1) {
-        this.bpmnElementListeners.push(listenerObject);
-        this.elementListenersList.push(this.listenerForm);
-      } else {
-        this.bpmnElementListeners.splice(this.editingListenerIndex, 1, listenerObject);
-        this.elementListenersList.splice(this.editingListenerIndex, 1, this.listenerForm);
+          .then(() => {
+            this.bpmnElementListeners.splice(index, 1);
+            this.elementListenersList.splice(index, 1);
+            updateElementExtensions(
+              this.bpmnElement,
+              this.otherExtensionList.concat(this.bpmnElementListeners)
+            );
+          })
+          .catch(() => console.info('操作取消'));
+      },
+      // 保存监听器配置
+      async saveListenerConfig() {
+        let validateStatus = await this.$refs['listenerFormRef'].validate();
+        if (!validateStatus) return; // 验证不通过直接返回
+        const listenerObject = createListenerObject(
+          this.listenerForm,
+          false,
+          this.prefix
+        );
+        if (this.editingListenerIndex === -1) {
+          this.bpmnElementListeners.push(listenerObject);
+          this.elementListenersList.push(this.listenerForm);
+        } else {
+          this.bpmnElementListeners.splice(
+            this.editingListenerIndex,
+            1,
+            listenerObject
+          );
+          this.elementListenersList.splice(
+            this.editingListenerIndex,
+            1,
+            this.listenerForm
+          );
+        }
+        // 保存其他配置
+        this.otherExtensionList =
+          this.bpmnElement.businessObject?.extensionElements?.values?.filter(
+            (ex) => ex.$type !== `${this.prefix}:ExecutionListener`
+          ) ?? [];
+        updateElementExtensions(
+          this.bpmnElement,
+          this.otherExtensionList.concat(this.bpmnElementListeners)
+        );
+        // 4. 隐藏侧边栏
+        this.listenerFormModelVisible = false;
+        this.listenerForm = {};
       }
-      // 保存其他配置
-      this.otherExtensionList = this.bpmnElement.businessObject?.extensionElements?.values?.filter(ex => ex.$type !== `${this.prefix}:ExecutionListener`) ?? [];
-      updateElementExtensions(this.bpmnElement, this.otherExtensionList.concat(this.bpmnElementListeners));
-      // 4. 隐藏侧边栏
-      this.listenerFormModelVisible = false;
-      this.listenerForm = {};
     }
-  }
-};
+  };
 </script>

+ 44 - 10
src/views/material/product/components/QualityInfo.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="other">
-    <el-form label-width="100px" ref="form" :model="form">
+    <el-form label-width="100px" ref="form" :model="form" :rules="rules">
       <div class="divider">
         <div class="title">
           <div class="ele-bg-primary"></div>
@@ -15,10 +15,10 @@
             <el-radio v-model="form.isComeCheck" :label="0">否</el-radio>
           </el-form-item>
         </el-col>
-        <el-col :span="6" v-if="form.isComeCheck == 1">
-          <el-form-item label="检验标准" prop="inspectionStandards">
-            <!-- 计量 计重 -->
-            <el-select
+        <!-- <el-col :span="6" v-if="form.isComeCheck == 1">
+          <el-form-item label="检验标准" prop="inspectionStandards"> -->
+        <!-- 计量 计重 -->
+        <!-- <el-select
               style="width: 100%"
               v-model="form.inspectionStandards"
               placeholder="请选择"
@@ -32,9 +32,9 @@
               </el-option>
             </el-select>
           </el-form-item>
-        </el-col>
+        </el-col> -->
         <el-col :span="6" v-if="form.isComeCheck == 1">
-          <el-form-item label="物料级别" prop="checkFormula">
+          <el-form-item label="物料级别" prop="levelItem">
             <el-select
               style="width: 100%"
               v-model="form.levelItem"
@@ -62,7 +62,7 @@
         </el-col>
         <el-col
           :span="6"
-          v-if="form.isComeCheck == 1 && form.checkFormula == 1"
+          v-if="form.isComeCheck == 1 && form.checkFormula == 2"
         >
           <el-form-item label="抽检比例" prop="checkProportion">
             <el-input
@@ -76,10 +76,28 @@
             </el-input>
           </el-form-item>
         </el-col>
+
+        <!-- <el-col :span="8" v-if="form.isComeCheck == 1">
+          <el-form-item label="质检方案" prop="">
+            <el-select
+              style="width: 100%"
+              v-model="form.qualityTemplateIds"
+              filterable
+              multiple
+            >
+              <el-option
+                v-for="item in qualityTemplateList"
+                :key="item.id"
+                :value="item.id"
+                :label="item.qualitySchemeTemplateName"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+        </el-col> -->
       </el-row>
       <el-row>
         <el-col :span="8" v-if="form.isComeCheck == 1">
-          <el-form-item label="质检方案" prop="">
+          <el-form-item label="质检方案" prop="qualityTemplateIds">
             <el-select
               style="width: 100%"
               v-model="form.qualityTemplateIds"
@@ -115,7 +133,23 @@
       return {
         qualityTemplateList: [],
         levelOptions: [],
-        inspectionStandardsList: []
+        inspectionStandardsList: [],
+        rules: {
+          checkFormula: [
+            {
+              required: true,
+              message: '请选择检验方式',
+              trigger: 'change'
+            }
+          ],
+          qualityTemplateIds: [
+            {
+              required: true,
+              message: '请选择质检方案',
+              trigger: 'change'
+            }
+          ]
+        }
       };
     },
     watch: {},

+ 1020 - 911
src/views/material/product/detail.vue

@@ -1,67 +1,107 @@
 <template>
   <div class="ele-body">
     <el-card shadow="never">
-      <el-form label-width="100px" ref="manageForm" :model="form" :rules="rules">
+      <el-form
+        label-width="100px"
+        ref="manageForm"
+        :model="form"
+        :rules="rules"
+      >
         <headerTitle title="基本信息">
           <el-button @click="cancel">返回</el-button>
-          <el-button type="primary" @click="submit" :loading="loading">保存
+          <el-button type="primary" @click="submit" :loading="loading"
+            >保存
           </el-button>
         </headerTitle>
 
         <el-row :gutter="24">
           <el-col :span="8">
             <el-form-item label="分类" prop="categoryLevelName">
-              <el-input v-model="form.categoryLevelName" @click.native="openCategory" />
+              <el-input
+                v-model="form.categoryLevelName"
+                @click.native="openCategory"
+              />
             </el-form-item>
           </el-col>
 
           <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-input
+                v-if="ruleCode == '自定义'"
+                v-model="form.code"
+                readonly
+                @click.native="openCode"
+                :disabled="status == 0"
+              />
               <el-input v-else 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-form-item>
           </el-col>
-     
+
           <el-col :span="8">
             <el-form-item label="存货类型:" prop="attributeType">
-              <el-select v-model="form.attributeType" filterable class="ele-block">
-                <el-option v-for="item in attributeList" :key="item.value" :value="item.value"
-                  :label="item.label"></el-option>
+              <el-select
+                v-model="form.attributeType"
+                filterable
+                class="ele-block"
+              >
+                <el-option
+                  v-for="item in attributeList"
+                  :key="item.value"
+                  :value="item.value"
+                  :label="item.label"
+                ></el-option>
               </el-select>
             </el-form-item>
           </el-col>
-          
+
           <el-col :span="8">
             <div>
               <el-form-item label="属性类型" prop="componentAttribute">
-                <el-select style="width: 100%" v-model="form.componentAttribute" filterable multiple>
-                  <el-option v-for="item in lbjtList" :key="item.value" :value="item.value"
-                    :label="item.label"></el-option>
+                <el-select
+                  style="width: 100%"
+                  v-model="form.componentAttribute"
+                  filterable
+                  multiple
+                >
+                  <el-option
+                    v-for="item in lbjtList"
+                    :key="item.value"
+                    :value="item.value"
+                    :label="item.label"
+                  ></el-option>
                 </el-select>
               </el-form-item>
             </div>
-
           </el-col>
           <el-col :span="8">
             <div>
-              <el-form-item label="生产类型" prop="produceType"
+              <el-form-item
+                label="生产类型"
+                prop="produceType"
                 :rules="{
-                    required: form.categoryLevelPathId==9 ? true : false,
-                    message: '请选择生产类型',
-                    trigger: 'change'
-                        }"
+                  required: form.categoryLevelPathId == 9 ? true : false,
+                  message: '请选择生产类型',
+                  trigger: 'change'
+                }"
               >
-                <el-select style="width: 100%" v-model="form.produceType" filterable @change="produceTypeChange">
-                  <el-option v-for="item in produceTypeList" :key="item.value" :value="item.value"
-                    :label="item.label"></el-option>
+                <el-select
+                  style="width: 100%"
+                  v-model="form.produceType"
+                  filterable
+                  @change="produceTypeChange"
+                >
+                  <el-option
+                    v-for="item in produceTypeList"
+                    :key="item.value"
+                    :value="item.value"
+                    :label="item.label"
+                  ></el-option>
                 </el-select>
               </el-form-item>
             </div>
@@ -74,7 +114,11 @@
             )
           " -->
             <el-form-item label="加工类型" prop="isConsumable">
-              <el-select v-model="form.isConsumable" style="width: 100%" @change="changeConsumable">
+              <el-select
+                v-model="form.isConsumable"
+                style="width: 100%"
+                @change="changeConsumable"
+              >
                 <el-option :value="1" label="批量"></el-option>
                 <el-option :value="0" label="单件"></el-option>
               </el-select>
@@ -100,29 +144,52 @@
 
           <el-col :span="8">
             <el-form-item label="计量类型" prop="measureType">
-              <el-select v-model="form.measureType" style="width: 100%" @change="changeMeasureType">
-                <el-option v-for="item in measureTypeList" :key="item.value" :value="item.value"
-                  :label="item.label"></el-option>
+              <el-select
+                v-model="form.measureType"
+                style="width: 100%"
+                @change="changeMeasureType"
+              >
+                <el-option
+                  v-for="item in measureTypeList"
+                  :key="item.value"
+                  :value="item.value"
+                  :label="item.label"
+                ></el-option>
               </el-select>
             </el-form-item>
           </el-col>
           <el-col :span="8">
             <el-form-item label="计量单位" prop="measuringUnit">
-              <DictSelection dictName="计量单位" clearable v-model="form.measuringUnit" @change="changeUnit">
+              <DictSelection
+                dictName="计量单位"
+                clearable
+                v-model="form.measuringUnit"
+                @change="changeUnit"
+              >
               </DictSelection>
             </el-form-item>
           </el-col>
 
           <el-col :span="8">
             <el-form-item label="重量单位" prop="weightUnit">
-              <DictSelection dictName="重量单位" clearable v-model="form.weightUnit" @change="changeWeightUnit">
+              <DictSelection
+                dictName="重量单位"
+                clearable
+                v-model="form.weightUnit"
+                @change="changeWeightUnit"
+              >
               </DictSelection>
             </el-form-item>
           </el-col>
 
           <el-col :span="8">
             <el-form-item label="包装单位" prop="packingUnit">
-              <DictSelection dictName="包装单位" clearable v-model="form.packingUnit" @change="changeUnit">
+              <DictSelection
+                dictName="包装单位"
+                clearable
+                v-model="form.packingUnit"
+                @change="changeUnit"
+              >
               </DictSelection>
             </el-form-item>
           </el-col>
@@ -132,7 +199,6 @@
             </el-form-item>
           </el-col>
 
-
           <el-col :span="8">
             <el-form-item label="毛重">
               <div class="form-line">
@@ -143,8 +209,15 @@
 
           <el-col :span="8">
             <!-- 计量类型为重量 净重必填 -->
-            <el-form-item label="净重" prop="netWeight"
-              :rules="{ required: form.measureType==2, trigger: ['blur', 'change'], message: '请输入净重', }">
+            <el-form-item
+              label="净重"
+              prop="netWeight"
+              :rules="{
+                required: form.measureType == 2,
+                trigger: ['blur', 'change'],
+                message: '请输入净重'
+              }"
+            >
               <div class="form-line">
                 <el-input v-model="form.netWeight" @input="handleInput3" />
               </div>
@@ -153,9 +226,17 @@
           <el-col :span="8">
             <el-form-item label="体积">
               <div class="form-line">
-                <el-input v-model="form.volume" style="width: calc(100% - 100px)" />
+                <el-input
+                  v-model="form.volume"
+                  style="width: calc(100% - 100px)"
+                />
                 <!-- @input="handleInput1" -->
-                <DictSelection dictName="体积单位" clearable v-model="form.volumeUnit" style="width: 100px">
+                <DictSelection
+                  dictName="体积单位"
+                  clearable
+                  v-model="form.volumeUnit"
+                  style="width: 100px"
+                >
                 </DictSelection>
               </div>
             </el-form-item>
@@ -163,8 +244,17 @@
           <el-col :span="8">
             <el-form-item label="级别">
               <template>
-                <el-select style="width: 100%" v-model="form.level" placeholder="请选择">
-                  <el-option v-for="item in levelOptions" :label="item.label" :value="item.value" :key="item.value">
+                <el-select
+                  style="width: 100%"
+                  v-model="form.level"
+                  placeholder="请选择"
+                >
+                  <el-option
+                    v-for="item in levelOptions"
+                    :label="item.label"
+                    :value="item.value"
+                    :key="item.value"
+                  >
                   </el-option>
                 </el-select>
               </template>
@@ -173,12 +263,13 @@
           <el-col :span="8">
             <el-form-item label="状态">
               <template>
-
-                <el-switch v-model="form.isEnabled" :active-text="form.isEnabled == 1 ? '启用' : '停用'" :active-value="1"
-                  :inactive-value="0">
+                <el-switch
+                  v-model="form.isEnabled"
+                  :active-text="form.isEnabled == 1 ? '启用' : '停用'"
+                  :active-value="1"
+                  :inactive-value="0"
+                >
                 </el-switch>
-
-
               </template>
             </el-form-item>
           </el-col>
@@ -187,16 +278,20 @@
             <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>
           </el-col>
-
-
         </el-row>
       </el-form>
     </el-card>
@@ -214,13 +309,24 @@
     </el-card>
 
     <!--  自定义编码 -->
-    <CodeDialog ref="codeRefs" v-if="codeShow" @close="codeShow = false" @chooseCode="chooseCode" />
+    <CodeDialog
+      ref="codeRefs"
+      v-if="codeShow"
+      @close="codeShow = false"
+      @chooseCode="chooseCode"
+    />
     <!-- 分类选择弹窗 -->
     <CategoryDialog ref="categoryRefs" @chooseCategory="confirmCategory" />
     <!-- 仓储配置 -->
-    <WarehouseInfo ref="warehouseRefs" v-if="isShow" :form="categoryWms" :measuringUnit="form.measuringUnit"
-      :packingUnit="form.packingUnit" :packageDispositionVOList="packageDispositionVOList"
-      @change="changePackagingSpecification" />
+    <WarehouseInfo
+      ref="warehouseRefs"
+      v-if="isShow"
+      :form="categoryWms"
+      :measuringUnit="form.measuringUnit"
+      :packingUnit="form.packingUnit"
+      :packageDispositionVOList="packageDispositionVOList"
+      @change="changePackagingSpecification"
+    />
     <!-- 销售配置 -->
     <SalesInfos ref="salesRefs" :form="categorySales" />
     <!-- 采购信息 -->
@@ -240,955 +346,958 @@
     <!-- 备注信息 -->
     <RemarkInfo ref="remarkRefs" :form="remarkform" />
     <!-- 关联信息 -->
-    <linkMsg ref="linkMsgRef" :id="$route.query.id" :categoryLevelId="form.categoryLevelId"
-      :categoryLevelGroupId="form.categoryLevelGroupId" :code="form.code" />
+    <linkMsg
+      ref="linkMsgRef"
+      :id="$route.query.id"
+      :categoryLevelId="form.categoryLevelId"
+      :categoryLevelGroupId="form.categoryLevelGroupId"
+      :code="form.code"
+    />
   </div>
 </template>
 
 <script>
-import SalesInfos from './components/SalesInfos.vue';
-import PurchasingInfo from './components/PurchasingInfo.vue';
-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, checkExist } from '@/api/codeManagement';
-// /main/category/checkExist
-import { addMaterial } from '@/api/material/list.js';
-import { deepClone } from '@/utils/index';
-import { finishPageTab, reloadPageTab } from '@/utils/page-tab-util';
-import { produceTypeList } from '@/enum/dict.js';
-
-export default {
-  name: 'product',
-  components: {
-    SalesInfos,
-    PurchasingInfo,
-    linkMsg,
-    GroupDialog,
-    deptSelect,
-    personSelect,
-    WarehouseInfo,
-    ProcureInfo,
-    ProductionInfo,
-    PlanInfo,
-    SalesInfo,
-    QualityInfo,
-    BoatInfo,
-    TurnoverInfo,
-    MoldInfo,
-    RemarkInfo,
-    CategoryDialog,
-    CodeDialog
-  },
-  data() {
-    return {
-      isShow: true,
-      produceTypeList,
-      packagingSpecificationList: [],
-      loading: false,
-      measureTypeList: [
-        {
-          label: '数量',
-          value: 1
-        },
-        {
-          label: '重量',
-          value: 2
-        },
-        {
-          label: '体积',
-          value: 3
-        }, {
-          label: '容积',
-          value: 4
-        },
-        {
-          label: '面积',
-          value: 5
-        },
-      ],
-      levelOptions: [
-        {
-          label: '特级',
-          value: '特级'
-        },
-        {
-          label: '一级',
-          value: '一级'
-        },
-        {
-          label: '二级',
-          value: '二级'
-        },
-        {
-          label: '三级',
-          value: '三级'
-        }
-      ],
-
-      isUpdate: 0,
-      form: {
-        categoryLevelGroupName: '',
-        componentAttribute: [],
-        categoryLevelName: '',
-        isConsumable: 0,
-        isEnabled: 1,
-        measuringUnit: '',
-        netWeight: '',
-        attributeType: 1,
-        weightUnit: '',
-        packingUnit: '',
-
-        extField: {},
-        // isConsumables:2,
-        extTagField: {
-          isConsumables: 0,
-        },
+  import SalesInfos from './components/SalesInfos.vue';
+  import PurchasingInfo from './components/PurchasingInfo.vue';
+  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,
+    checkExist
+  } from '@/api/codeManagement';
+  // /main/category/checkExist
+  import { addMaterial } from '@/api/material/list.js';
+  import { deepClone } from '@/utils/index';
+  import { finishPageTab, reloadPageTab } from '@/utils/page-tab-util';
+  import { produceTypeList } from '@/enum/dict.js';
+
+  export default {
+    name: 'product',
+    components: {
+      SalesInfos,
+      PurchasingInfo,
+      linkMsg,
+      GroupDialog,
+      deptSelect,
+      personSelect,
+      WarehouseInfo,
+      ProcureInfo,
+      ProductionInfo,
+      PlanInfo,
+      SalesInfo,
+      QualityInfo,
+      BoatInfo,
+      TurnoverInfo,
+      MoldInfo,
+      RemarkInfo,
+      CategoryDialog,
+      CodeDialog
+    },
+    data() {
+      return {
+        isShow: true,
+        produceTypeList,
+        packagingSpecificationList: [],
+        loading: false,
+        measureTypeList: [
+          {
+            label: '数量',
+            value: 1
+          },
+          {
+            label: '重量',
+            value: 2
+          },
+          {
+            label: '体积',
+            value: 3
+          },
+          {
+            label: '容积',
+            value: 4
+          },
+          {
+            label: '面积',
+            value: 5
+          }
+        ],
+        levelOptions: [
+          {
+            label: '特级',
+            value: '特级'
+          },
+          {
+            label: '一级',
+            value: '一级'
+          },
+          {
+            label: '二级',
+            value: '二级'
+          },
+          {
+            label: '三级',
+            value: '三级'
+          }
+        ],
 
-      },
-      lbjtList: [
-        {
-          label: '自制件',
-          value: 1
+        isUpdate: 0,
+        form: {
+          categoryLevelGroupName: '',
+          componentAttribute: [],
+          categoryLevelName: '',
+          isConsumable: 0,
+          isEnabled: 1,
+          measuringUnit: '',
+          netWeight: '',
+          attributeType: 1,
+          weightUnit: '',
+          packingUnit: '',
+
+          extField: {},
+          // isConsumables:2,
+          extTagField: {
+            isConsumables: 0
+          }
         },
-        {
-          label: '采购件',
-          value: 2
+        lbjtList: [
+          {
+            label: '自制件',
+            value: 1
+          },
+          {
+            label: '采购件',
+            value: 2
+          },
+          {
+            label: '外协件',
+            value: 3
+          },
+          {
+            label: '受托件',
+            value: 4
+          }
+        ],
+        attributeList: [
+          {
+            label: '总装',
+            value: 1
+          },
+          {
+            label: '部件',
+            value: 2
+          },
+          {
+            label: '零件',
+            value: 3
+          },
+          {
+            label: '原材料',
+            value: 4
+          }
+        ],
+        remarkform: {
+          remarkAttach: []
         },
-        {
-          label: '外协件',
-          value: 3
-        }, {
-          label: '受托件',
-          value: 4
-        }
-      ],
-      attributeList: [
-        {
-          label: '总装',
-          value: 1
+        categorySales: {},
+        categoryPurchase: { purchaseMultiplier: 1, measuringUnit: '' },
+        categoryAps: {},
+        categoryMes: { productionDays: '1' },
+        categoryMold: {},
+        categoryPallet: {},
+        categoryQms: {
+          isComeCheck: '1'
         },
-        {
-          label: '部件',
-          value: 2
+        categoryVehicle: {},
+        categoryWms: {
+          isUnpack: 1,
+          isWarn: 1,
+          inventoryMode: '',
+          secureInventory: '1',
+          minInventory: '1',
+          maxInventory: '1'
         },
-        {
-          label: '零件',
-          value: 3
-        }, {
-          label: '原材料',
-          value: 4
-        }
-      ],
-      remarkform: {
-        remarkAttach: []
-      },
-      categorySales: {},
-      categoryPurchase: { purchaseMultiplier: 1, measuringUnit: '' },
-      categoryAps: {},
-      categoryMes: { productionDays: '1' },
-      categoryMold: {},
-      categoryPallet: {},
-      categoryQms: {
-        isComeCheck: '1'
-      },
-      categoryVehicle: {},
-      categoryWms: {
-        isUnpack: 1,
-        isWarn: 1,
-        inventoryMode: '',
-        secureInventory: '1',
-        minInventory: '1',
-        maxInventory: '1',
-      },
-      packageDispositionVOList: [],
-      categoryLevelPathId: null,
+        packageDispositionVOList: [],
+        categoryLevelPathId: null,
 
-      dictList: [
-        {
-          label: '加工',
-          value: 1
-        },
-        {
-          label: '装配',
-          value: 3
-        },
-      ],
-      fileList: [],
-      // 表单验证规则
-      rules: {
-        measureType: [
-          { required: true, message: '请选择计量类型', trigger: 'change' }
-        ],
-        categoryLevelGroupName: [
-          { required: true, message: '请选择所属物料组', trigger: 'change' }
-        ],
-        code: [{ required: true, message: '请输入编码', trigger: 'blur' }],
-        name: [{ required: true, message: '请输入名称', trigger: 'blur' }],
-        // produceType: [
-        //   { required: true, message: '请选择生产类型', trigger: 'change' }
-        // ],
-        componentAttribute: [
-          { required: true, message: '请选择属性类型', trigger: 'change' }
-        ],
-        attributeType: [
-          { required: true, message: '请选择属性类型', trigger: 'change' }
-        ],
-        categoryLevelName: [
-          { required: true, message: '请选择所属分类', trigger: 'change' }
-        ],
-        measuringUnit: [
-          { required: true, message: '请选择计量单位', trigger: 'change' }
+        dictList: [
+          {
+            label: '加工',
+            value: 1
+          },
+          {
+            label: '装配',
+            value: 3
+          }
         ],
+        fileList: [],
+        // 表单验证规则
+        rules: {
+          measureType: [
+            { required: true, message: '请选择计量类型', trigger: 'change' }
+          ],
+          categoryLevelGroupName: [
+            { required: true, message: '请选择所属物料组', trigger: 'change' }
+          ],
+          code: [{ required: true, message: '请输入编码', trigger: 'blur' }],
+          name: [{ required: true, message: '请输入名称', trigger: 'blur' }],
+          // produceType: [
+          //   { required: true, message: '请选择生产类型', trigger: 'change' }
+          // ],
+          componentAttribute: [
+            { required: true, message: '请选择属性类型', trigger: 'change' }
+          ],
+          attributeType: [
+            { required: true, message: '请选择属性类型', trigger: 'change' }
+          ],
+          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,
 
-        weightUnit: [
-          { required: true, message: '请选择重量单位', trigger: 'change' }
-        ],
+        ruleCode: null,
+        codeShow: false,
 
-        packingUnit: [
-          { required: true, message: '请选择包装单位', trigger: 'change' }
-        ],
+        status: null
+      };
+    },
+    watch: {
+      '$route.query.id': {
+        handler(id) {
+          if (id) {
+            this._getDetails();
+          } else {
+            let { lyType } = this.$route.query;
 
-        netWeight: [
-          { required: true, message: '请输入净重', trigger: 'blur' }
-        ]
-      },
-      PathInfo: {},
-      id: null,
-
-      ruleCode: null,
-      codeShow: false,
-
-      status: null
-    };
-  },
-  watch: {
-    '$route.query.id': {
-      handler(id) {
-        if (id) {
-          this._getDetails();
-        } else {
-          let { lyType } = this.$route.query;
+            let arrId = '';
+            if (lyType == 'wp') {
+              arrId = 3;
+            }
+            if (lyType == 'cp') {
+              arrId = 1;
+            }
 
-          let arrId = '';
-          if (lyType == "wp") {
-            arrId = 3
-          }
-          if (lyType == "cp") {
-            arrId = 1
+            this.form = {
+              categoryLevelGroupName: '',
+              // categoryLevelName: '',
+              componentAttribute: [],
+              isConsumable: 0,
+              attributeType: arrId,
+              measuringUnit: '',
+              netWeight: '',
+              weightUnit: '',
+              packingUnit: '',
+              extField: {},
+              extTagField: {
+                isConsumables: 0
+              },
+              measureType: 1,
+              isEnabled: 1
+            };
+
+            this.isUpdate = 0;
+
+            this.categorySales = {};
+            this.purchaseInfo = {};
+            this.remarkform = {
+              remarkAttach: []
+            };
+            this.categoryAps = {};
+            this.categoryMes = {
+              productionDays: '20',
+              isCompleteSet: 0,
+              isModify: 0,
+              isRework: 0,
+              isRematerial: 0,
+              isByProduct: 0,
+              isWaste: 0,
+              isDefective: 0
+            };
+            this.categoryMold = {};
+            this.categoryPallet = {};
+            this.categoryQms = {};
+            this.categoryVehicle = {};
+            this.categoryWms = {
+              isUnpack: 1,
+              isWarn: 1,
+              inventoryMode: this.form.isConsumable,
+              minPackageCell: '',
+              secureInventory: '10',
+              minInventory: '10',
+              maxInventory: '10'
+            };
+            this.packageDispositionVOList = [];
+            this.categoryLevelPathId = null;
+
+            // this.dictList = [];
+
+            this.fileList = [];
           }
-
-          this.form = {
-            categoryLevelGroupName: '',
-            // categoryLevelName: '',
-            componentAttribute: [],
-            isConsumable: 0,
-            attributeType: arrId,
-            measuringUnit: '',
-            netWeight: '',
-            weightUnit: '',
-            packingUnit: '',
-            extField: {},
-            extTagField: {
-              isConsumables: 0,
-            },
-            measureType: 1,
-            isEnabled: 1,
-
-          };
-
-          
-          this.isUpdate = 0;
-
-          this.categorySales = {};
-          this.purchaseInfo = {};
-          this.remarkform = {
-            remarkAttach: []
-          };
-          this.categoryAps = {};
-          this.categoryMes = { productionDays: '20', isCompleteSet: 0, isModify: 0, isRework: 0, isRematerial: 0, isByProduct: 0, isWaste: 0, isDefective: 0 };
-          this.categoryMold = {};
-          this.categoryPallet = {};
-          this.categoryQms = {};
-          this.categoryVehicle = {};
-          this.categoryWms = {
-            isUnpack: 1,
-            isWarn: 1,
-            inventoryMode: this.form.isConsumable,
-            minPackageCell: '',
-            secureInventory: '10',
-            minInventory: '10',
-            maxInventory: '10',
-          };
-          this.packageDispositionVOList = [];
-          this.categoryLevelPathId = null;
-
-          // this.dictList = [];
-
-          this.fileList = [];
-        }
-      },
-      deep: true,
-      immediate: true
-    }
-  },
-  async activated() {
-    this.status = this.$route.query.status;
-    this.form.categoryLevelId = this.$route.query.categoryLevelId;
-    this.form.categoryLevelName = this.$route.query.categoryLevelName;
-    this.form.categoryLevelPath = this.$route.query.categoryLevelPath;
-    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.getDictList('zeroPartPros');
-  },
-  async created() {
-    //新增
-    console.log('88888888');
-
-    this.$set(
-      this.form,
-      'categoryLevelId',
-      this.$route.query.categoryLevelId
-    );
-
-
-    this.$set(
-      this.form,
-      'isUpdate',
-      this.$route.query.isUpdate
-    );
-
-    this.isUpdate = this.$route.query.isUpdate;
-
-
-    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.status = this.$route.query.status;
-    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.getDictList('zeroPartPros');
-  },
-  methods: {
-    inputSpe(val) {
-      if (this.form.measuringUnit == '立方') {
-        if (!val || typeof val !== 'string') {
-          this.form.volume = 0;
-          return;
-        };
-
-        let modelArr = val.split('*');
-        let modelLong = modelArr[0]; // model规格长度
-        let modeWide = modelArr[1]; // model规格宽度
-        let modeHight = modelArr[2]?.substr(0, modelArr[2].indexOf('cm')); // model规格高度
-        modeHight = Number(modeHight);
-
-        let aa = (modelLong * modeWide * modeHight) / 1000000;
-        console.log(aa, 'aa')
-        this.form.volume = aa;
-      } else {
-        this.form.volume = '';
+        },
+        deep: true,
+        immediate: true
       }
-
     },
-    changeMeasureType() {
-      if (this.form.measureType == 1) {
-        this.$set(this.categoryWms, 'isUnpack', 1);
-      } else {
-        this.$set(this.categoryWms, 'isUnpack', 0);
+    async activated() {
+      this.status = this.$route.query.status;
+      this.form.categoryLevelId = this.$route.query.categoryLevelId;
+      this.form.categoryLevelName = this.$route.query.categoryLevelName;
+      this.form.categoryLevelPath = this.$route.query.categoryLevelPath;
+      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.getDictList('zeroPartPros');
     },
-    handleInput(value) {
-      // this.form.volume = this.$handleInputPublicHasPoint(value);
-    },
-    handleInput2(value) {
-      this.form.roughWeight = this.$handleInputPublicHasPoint(value);
-    },
-    handleInput3(value) {
-      // this.form.netWeight = this.$handleInputPublicHasPoint(value);
-      if (this.form.weightUnit == this.form.measuringUnit) {
-        this.$refs.warehouseRefs.changeNetWeight(this.form.netWeight);
-      }
-    },
-    changeConsumable() {
-      this.$set(this.categoryWms, 'inventoryMode', this.form.isConsumable);
-    },
-    changeWeightUnit() {
-      if (this.form.measuringUnit && this.form.packingUnit && this.form.netWeight) {
-        this.$refs.warehouseRefs.changeNetWeight(this.form.netWeight);
+    async created() {
+      //新增
+      console.log('88888888');
+
+      this.$set(
+        this.form,
+        'categoryLevelId',
+        this.$route.query.categoryLevelId
+      );
+
+      this.$set(this.form, 'isUpdate', this.$route.query.isUpdate);
+
+      this.isUpdate = this.$route.query.isUpdate;
+
+      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.status = this.$route.query.status;
+      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.getDictList('zeroPartPros');
     },
-    changeUnit() {
-      if (this.$route.query.id == '' || this.$route.query.id == null) {
-
-        if (this.form.measuringUnit) {
-          // 计量单位是‘立方’   体积单位默认是‘立方’
-          if (this.form.measuringUnit == '立方' && this.form.specification != '') {
-            this.form.volumeUnit = '立方';
-            this.inputSpe(this.form.specification)
-          } else {
+    methods: {
+      inputSpe(val) {
+        if (this.form.measuringUnit == '立方') {
+          if (!val || typeof val !== 'string') {
             this.form.volume = 0;
+            return;
           }
-          this.categoryPurchase.measuringUnit = this.form.measuringUnit;
-          console.log(this.categoryPurchase.measuringUnit, '采购信息');
-          // 如果有计量单位和包装单位 默认添加包装组
-          if (this.form.packingUnit) {
-            this.$refs.warehouseRefs.defaultBuild(this.form.packingUnit);
-          }
+
+          let modelArr = val.split('*');
+          let modelLong = modelArr[0]; // model规格长度
+          let modeWide = modelArr[1]; // model规格宽度
+          let modeHight = modelArr[2]?.substr(0, modelArr[2].indexOf('cm')); // model规格高度
+          modeHight = Number(modeHight);
+
+          let aa = (modelLong * modeWide * modeHight) / 1000000;
+          console.log(aa, 'aa');
+          this.form.volume = aa;
+        } else {
+          this.form.volume = '';
+        }
+      },
+      changeMeasureType() {
+        if (this.form.measureType == 1) {
+          this.$set(this.categoryWms, 'isUnpack', 1);
+        } else {
+          this.$set(this.categoryWms, 'isUnpack', 0);
         }
-      } else {
-        this.isShow = false;
-        if (this.form.measuringUnit) {
-          this.categoryPurchase.measuringUnit = this.form.measuringUnit;
-
-          if (this.form.packingUnit) {
-            console.log(this.form.measuringUnit, 'this.form.measuringUnit');
-            console.log(this.form.packingUnit, 'this.form.packingUnit');
-            if (this.packageDispositionVOList.length === 0) {
-              console.log('如果没有包装组');
+      },
+      handleInput(value) {
+        // this.form.volume = this.$handleInputPublicHasPoint(value);
+      },
+      handleInput2(value) {
+        this.form.roughWeight = this.$handleInputPublicHasPoint(value);
+      },
+      handleInput3(value) {
+        // this.form.netWeight = this.$handleInputPublicHasPoint(value);
+        if (this.form.weightUnit == this.form.measuringUnit) {
+          this.$refs.warehouseRefs.changeNetWeight(this.form.netWeight);
+        }
+      },
+      changeConsumable() {
+        this.$set(this.categoryWms, 'inventoryMode', this.form.isConsumable);
+      },
+      changeWeightUnit() {
+        if (
+          this.form.measuringUnit &&
+          this.form.packingUnit &&
+          this.form.netWeight
+        ) {
+          this.$refs.warehouseRefs.changeNetWeight(this.form.netWeight);
+        }
+      },
+      changeUnit() {
+        if (this.$route.query.id == '' || this.$route.query.id == null) {
+          if (this.form.measuringUnit) {
+            // 计量单位是‘立方’   体积单位默认是‘立方’
+            if (
+              this.form.measuringUnit == '立方' &&
+              this.form.specification != ''
+            ) {
+              this.form.volumeUnit = '立方';
+              this.inputSpe(this.form.specification);
+            } else {
+              this.form.volume = 0;
+            }
+            this.categoryPurchase.measuringUnit = this.form.measuringUnit;
+            console.log(this.categoryPurchase.measuringUnit, '采购信息');
+            // 如果有计量单位和包装单位 默认添加包装组
+            if (this.form.packingUnit) {
               this.$refs.warehouseRefs.defaultBuild(this.form.packingUnit);
             }
           }
+        } else {
+          this.isShow = false;
+          if (this.form.measuringUnit) {
+            this.categoryPurchase.measuringUnit = this.form.measuringUnit;
+
+            if (this.form.packingUnit) {
+              console.log(this.form.measuringUnit, 'this.form.measuringUnit');
+              console.log(this.form.packingUnit, 'this.form.packingUnit');
+              if (this.packageDispositionVOList.length === 0) {
+                console.log('如果没有包装组');
+                this.$refs.warehouseRefs.defaultBuild(this.form.packingUnit);
+              }
+            }
+          }
+          this.isShow = true;
         }
-        this.isShow = true;
-      }
-    },
-
-    changePackagingSpecification(val) {
-      this.packagingSpecificationList = val;
-    },
-    async _getDetails() {
-
-      const data = await getDetails(this.$route.query.id);
-
-
-      const info = deepClone(data);
-      info.category.produceType = info.category.produceType[0];
-
-      this.form = {
-        ...info.category
-      };
-
-      // if (this.form.measuringUnit && this.form.packingUnit) {
-      //   this.$refs.warehouseRefs.defaultBuild(this.form.packingUnit);
-      // }
-      this.categoryLevelPathId = info.category.categoryLevelPathIdParent;
-      this.judgeSet(info);
-
-      if (this.status == 1) {
-        rootCategoryCode(this.categoryLevelPathId).then((res) => {
-          this.$set(this.form, 'code', res);
-        });
+      },
 
-        this.form.createTime = null;
-      }
+      changePackagingSpecification(val) {
+        this.packagingSpecificationList = val;
+      },
+      async _getDetails() {
+        const data = await getDetails(this.$route.query.id);
 
-      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.categorySales == 'string') {
-        this.categorySales = {};
-      } else {
-        this.categorySales = info.categorySales;
-      }
+        const info = deepClone(data);
+        info.category.produceType = info.category.produceType[0];
 
-      if (typeof info.categoryPurchase == 'string') {
-        this.categoryPurchase = {};
-      } else {
-        this.categoryPurchase = info.categoryPurchase;
-      }
-      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
-        );
-      }
-    },
+        this.form = {
+          ...info.category
+        };
 
-    getFieldModel() {
-      fieldModel({ relevance: 't_main_category' }).then((res) => {
-        this.fileList = res;
+        // if (this.form.measuringUnit && this.form.packingUnit) {
+        //   this.$refs.warehouseRefs.defaultBuild(this.form.packingUnit);
+        // }
+        this.categoryLevelPathId = info.category.categoryLevelPathIdParent;
+        this.judgeSet(info);
 
-        if (!this.form.extTagField) {
-          this.form.extTagField = {
-            isConsumables: 0
-          }; // 初始化动态模型属性
+        if (this.status == 1) {
+          rootCategoryCode(this.categoryLevelPathId).then((res) => {
+            this.$set(this.form, 'code', res);
+          });
 
+          this.form.createTime = null;
         }
-        // this.$set(this.form.extTagField, 'isConsumables', 0); // 初始化动态模型属性
 
-        this.fileList.forEach((f) => {
-          this.$set(this.form.extField, f.prop, ''); // 初始化动态模型属性
-          // this.$set(this.form.extTagField, f.prop, ''); // 初始化动态模型属性  
-        });
-      });
-    },
+        this.$forceUpdate();
+      },
+      // 判断字段类型并赋值
+      judgeSet(info) {
+        console.log('info-------', info);
 
-    // 确定分类
-    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);
+        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.categorySales == 'string') {
+          this.categorySales = {};
+        } else {
+          this.categorySales = info.categorySales;
         }
-        console.log(this.form,'this.form')
-      }
-
-      this.$forceUpdate();
-    },
-
-    async getDictList(code) {
-      let { data: res } = await getByCode(code);
-
-      console.log('res----', res);
-
-      // this.lbjtList = res.map((item) => {
-      //   let values = Object.keys(item);
-      //   return {
-      //     value: Number(values[0]),
-      //     label: item[values[0]]
-      //   };
-      // });
-    },
-
-    openCategory() {
-      this.$refs.categoryRefs.open();
-    },
 
-    openCode() {
-      this.codeShow = true;
-    },
+        if (typeof info.categoryPurchase == 'string') {
+          this.categoryPurchase = {};
+        } else {
+          this.categoryPurchase = info.categoryPurchase;
+        }
+        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
+          );
+        }
+      },
 
-    chooseCode(code) {
-      this.$set(this.form, 'code', code);
-      this.codeShow = false;
-      this.$forceUpdate();
-    },
+      getFieldModel() {
+        fieldModel({ relevance: 't_main_category' }).then((res) => {
+          this.fileList = res;
 
-    cancel() {
-      // finishPageTab();
-      // this.$router.go(-1);
-      if (this.$route.query.rootTreeId == 9) {
-        this.$router.push({
-          path: '/product/oneProduct',
-          query: {
-            categoryLevelId: this.form.categoryLevelId
-          }
-        });
-      } else {
-        this.$router.push({
-          path: '/material/product',
-          query: {
-            categoryLevelId: this.form.categoryLevelId
-          }
-        });
-      }
-    },
-    verifyDuplicate(obj) {
-      return new Promise((resolve, reject) => {
-        checkExist(obj).then((res) => {
-          if (res) {
-
-            console.log(res, 'res----');
-
-            this.$confirm('系统已有相同的数据', '提示', {
-              confirmButtonText: '确定',
-              cancelButtonText: '取消',
-              type: 'warning'
-            }).then(() => {
-              resolve(true);
-            }).catch(() => {
-              resolve(false);
-            });
-          } else {
-            resolve(true);
+          if (!this.form.extTagField) {
+            this.form.extTagField = {
+              isConsumables: 0
+            }; // 初始化动态模型属性
           }
+          // this.$set(this.form.extTagField, 'isConsumables', 0); // 初始化动态模型属性
 
-
+          this.fileList.forEach((f) => {
+            this.$set(this.form.extField, f.prop, ''); // 初始化动态模型属性
+            // this.$set(this.form.extTagField, 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;
 
-    // 保存
-    submit() {
+          this.ruleCode = ruleCode;
 
+          if (ruleCode && ruleCode != '自定义' && this.status != 0) {
+            const code = await getCode(ruleCode);
+            this.$set(this.form, 'code', code);
+          }
+          console.log(this.form, 'this.form');
+        }
 
-      this.$refs.manageForm.validate(async (valid) => {
+        this.$forceUpdate();
+      },
 
-        if (!valid) return;
+      async getDictList(code) {
+        let { data: res } = await getByCode(code);
 
+        console.log('res----', res);
 
-        let req = {
-          name: this.form.name,
-          modelType: this.form.modelType,
-          specification: this.form.specification,
-          isUpdate: this.isUpdate * 1 || 0
-        }
+        // this.lbjtList = res.map((item) => {
+        //   let values = Object.keys(item);
+        //   return {
+        //     value: Number(values[0]),
+        //     label: item[values[0]]
+        //   };
+        // });
+      },
 
-        if (! await this.verifyDuplicate(req)) return;
+      openCategory() {
+        this.$refs.categoryRefs.open();
+      },
 
+      openCode() {
+        this.codeShow = true;
+      },
 
+      chooseCode(code) {
+        this.$set(this.form, 'code', code);
+        this.codeShow = false;
+        this.$forceUpdate();
+      },
 
+      cancel() {
+        // finishPageTab();
+        // this.$router.go(-1);
+        if (this.$route.query.rootTreeId == 9) {
+          this.$router.push({
+            path: '/product/oneProduct',
+            query: {
+              categoryLevelId: this.form.categoryLevelId
+            }
+          });
+        } else {
+          this.$router.push({
+            path: '/material/product',
+            query: {
+              categoryLevelId: this.form.categoryLevelId
+            }
+          });
+        }
+      },
+      verifyDuplicate(obj) {
+        return new Promise((resolve, reject) => {
+          checkExist(obj).then((res) => {
+            if (res) {
+              console.log(res, 'res----');
+
+              this.$confirm('系统已有相同的数据', '提示', {
+                confirmButtonText: '确定',
+                cancelButtonText: '取消',
+                type: 'warning'
+              })
+                .then(() => {
+                  resolve(true);
+                })
+                .catch(() => {
+                  resolve(false);
+                });
+            } else {
+              resolve(true);
+            }
+          });
+        });
+      },
 
+      // 保存
+      submit() {
+        this.$refs.manageForm.validate(async (valid) => {
+          console.log(this.$refs.qualityRefs);
 
+          if (!valid) return;
 
+          let req = {
+            name: this.form.name,
+            modelType: this.form.modelType,
+            specification: this.form.specification,
+            isUpdate: this.isUpdate * 1 || 0
+          };
 
+          if (!(await this.verifyDuplicate(req))) return;
 
+          let productionValid = await this.$refs.productionRefs.getFormValid();
+          let warehouseValid = await this.$refs.warehouseRefs.getFormValid();
+          if (!valid || !productionValid || !warehouseValid) {
+            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 = {
+            categorySales: this.categorySales,
+            categoryPurchase: this.categoryPurchase,
+            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()
+          };
 
-        let productionValid = await this.$refs.productionRefs.getFormValid();
-        let warehouseValid = await this.$refs.warehouseRefs.getFormValid();
-        if (!valid || !productionValid || !warehouseValid) {
-          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
+          if (this.$route.query.status == 1) {
+            data.categorySales.id = null;
+            data.categoryPurchase.id = null;
+            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}`
-              ];
+          data.category.produceType = data.category.produceType
+            ? [data.category.produceType]
+            : [];
+
+          addMaterial(data)
+            .then((msg) => {
+              this.loading = false;
+              this.$message.success(msg);
+              // reloadPageTab({ fullPath: '/material/product' });
+              // this.$router.go(-1);
+              this.cancel();
+              // if (this.$route.query.rootTreeId == 9) {
+              //   this.$router.push({
+              //     path: '/product/oneProduct',
+              //     query: {
+              //       categoryLevelId: this.form.categoryLevelId
+              //     }
+              //   });
+              // } else {
+              //   this.$router.push({
+              //     path: '/material/product',
+              //     query: {
+              //       categoryLevelId: this.form.categoryLevelId
+              //     }
+              //   });
+              // }
             })
-            .flat()
-            .join(',');
+            .catch((e) => {
+              this.loading = false;
+            });
+        });
+      },
+      //生产类型切换
+      produceTypeChange(value) {
+        if (value == 1) {
+          this.attributeList = [
+            {
+              label: '成品',
+              value: 1
+            },
+            {
+              label: '半成品',
+              value: 2
+            },
+            {
+              label: '原材料',
+              value: 4
+            }
+          ];
+          this.form.attributeType = 1;
         } 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 = {
-          categorySales: this.categorySales,
-          categoryPurchase: this.categoryPurchase,
-          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.categorySales.id = null;
-          data.categoryPurchase.id = null;
-          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.attributeList = [
+            {
+              label: '总装(成品)',
+              value: 1
+            },
+            {
+              label: '部件(半成品)',
+              value: 2
+            },
+            {
+              label: '零件',
+              value: 3
+            },
+            {
+              label: '原材料',
+              value: 4
             }
-          );
+          ];
+          this.form.attributeType = 1;
         }
-
-        data.category.produceType = data.category.produceType?[data.category.produceType]:[];
-
-        addMaterial(data)
-          .then((msg) => {
-            this.loading = false;
-            this.$message.success(msg);
-            // reloadPageTab({ fullPath: '/material/product' });
-            // this.$router.go(-1);
-            this.cancel();
-            // if (this.$route.query.rootTreeId == 9) {
-            //   this.$router.push({
-            //     path: '/product/oneProduct',
-            //     query: {
-            //       categoryLevelId: this.form.categoryLevelId
-            //     }
-            //   });
-            // } else {
-            //   this.$router.push({
-            //     path: '/material/product',
-            //     query: {
-            //       categoryLevelId: this.form.categoryLevelId
-            //     }
-            //   });
-            // }
-          })
-          .catch((e) => {
-            this.loading = false;
-          });
-      });
-    },
-    //生产类型切换
-    produceTypeChange(value){
-      if(value==1){
-        this.attributeList=[
-          {
-            label: '成品',
-            value: 1
-          },
-          {
-            label: '半成品',
-            value: 2
-          }, {
-            label: '原材料',
-            value: 4
-          }
-        ]
-        this.form.attributeType=1
-      }else{
-        this.attributeList=[
-          {
-            label: '总装(成品)',
-            value: 1
-          },
-          {
-            label: '部件(半成品)',
-            value: 2
-          },
-          {
-            label: '零件',
-            value: 3
-          }, {
-            label: '原材料',
-            value: 4
-          }
-        ]
-        this.form.attributeType=1
       }
     }
-  }
-};
+  };
 </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>

+ 2 - 6
vue.config.js

@@ -1,11 +1,7 @@
 const CompressionWebpackPlugin = require('compression-webpack-plugin');
-const {
-  transformElementScss
-} = require('ele-admin/lib/utils/dynamic-theme');
+const { transformElementScss } = require('ele-admin/lib/utils/dynamic-theme');
 const path = require('path');
-const {
-  name
-} = require('./package.json');
+const { name } = require('./package.json');
 
 function resolve(dir) {
   return path.join(__dirname, dir);