lxf 1 жил өмнө
parent
commit
77214e67e4

+ 57 - 91
src/components/byTable/ElementsMapping.vue

@@ -1,20 +1,14 @@
 <template>
   <div>
-    
-    <el-button v-for="(i,index) in getCellList"  @click="i.click()" :key="index" v-bind="i.attrs" v-show="index < 2">{{ i.attrs.label }}</el-button>
+    <el-button v-for="(i, index) in getCellList" @click="i.click()" :key="index" v-bind="i.attrs" v-show="index < 2">{{ i.attrs.label }}</el-button>
     <el-dropdown>
       <span class="el-dropdown-link">
         <span class="more-btn">更多</span>
-        
       </span>
       <template #dropdown>
         <el-dropdown-menu>
-          <el-dropdown-item 
-            :class="index > 1 ? '' : 'dn'" 
-            @click="i.click()" v-for="(i,index) in getCellList" 
-            
-            :key="index" >
-            <span :style="i.attrs.type == 'danger' ? 'color:red' : 'color:#409eff'">{{ i.attrs.label}}</span>
+          <el-dropdown-item :class="index > 1 ? '' : 'dn'" @click="i.click()" v-for="(i, index) in getCellList" :key="index">
+            <span :style="i.attrs.type == 'danger' ? 'color:red' : 'color:#409eff'">{{ i.attrs.label }}</span>
           </el-dropdown-item>
         </el-dropdown-menu>
       </template>
@@ -22,121 +16,93 @@
   </div>
 </template>
 <script>
-import {
-  defineComponent,
-  getCurrentInstance,
-  computed,
-  ref,
-  h,
-  withDirectives,
-  resolveDirective,
-  resolveComponent
-} from 'vue'
+import { defineComponent, getCurrentInstance, computed, ref, h, withDirectives, resolveDirective, resolveComponent } from "vue";
 export default defineComponent({
   props: {
     parent: {
       type: Object,
-      default () {
-        return {}
-      }
+      default() {
+        return {};
+      },
     },
     row: {
       type: Object,
-      default () {
-        return {}
-      }
+      default() {
+        return {};
+      },
     },
     cellList: {
       type: Array,
-      default () {
-        return []
-      }
-    }
+      default() {
+        return [];
+      },
+    },
   },
-  setup (props) {
-    const { proxy } = getCurrentInstance()
-    
-    proxy.$.components = props.parent.$options.components
-    proxy.$.directives = props.parent.$options.directives
+  setup(props) {
+    const { proxy } = getCurrentInstance();
+    proxy.$.components = props.parent.$options.components;
+    proxy.$.directives = props.parent.$options.directives;
     const elementsMapping = ref({
-      button: 'el-button'
-    })
+      button: "el-button",
+    });
     const getCellList = computed(() => {
-      return props.cellList.filter((cell) => cell && Object.keys(cell).length)
-    })
+      return props.cellList.filter((cell) => cell && Object.keys(cell).length);
+    });
     const getAttrsValue = (item) => {
       if (!item.attrs) {
-        item.attrs = {}
+        item.attrs = {};
       }
-      const {
-        class: className = null,
-        style = null,
-        directives = null,
-        ...attrs
-      } = item.attrs
+      const { class: className = null, style = null, directives = null, ...attrs } = item.attrs;
       return {
         class: className,
         style,
         directives,
-        props: attrs
-      }
-    }
-    if(getCellList.value.length > 3) {
+        props: attrs,
+      };
+    };
+    if (getCellList.value.length > 3) {
       return {
-        getCellList
-      }
+        getCellList,
+      };
     }
     return () => {
       return h(
-        'div',
+        "div",
         getCellList.value.map((cellItem) => {
-          const comp = resolveComponent(
-            elementsMapping.value[cellItem.el] ||
-            cellItem.el
-          )
-          const attributes = getAttrsValue(cellItem)
-          const { label, ...others } = attributes.props
-          const { directives } = attributes
-          let onClick
+          const comp = resolveComponent(elementsMapping.value[cellItem.el] || cellItem.el);
+          const attributes = getAttrsValue(cellItem);
+          const { label, ...others } = attributes.props;
+          const { directives } = attributes;
+          let onClick;
           if (cellItem.click) {
-            onClick = cellItem.click.bind(props.parent, props.row)
+            onClick = cellItem.click.bind(props.parent, props.row);
           }
-          let resultVNode = h(
-            comp,
-            {
-              onClick,
-              innerHTML: label,
-              ...others
-            }
-          )
+          let resultVNode = h(comp, {
+            onClick,
+            innerHTML: label,
+            ...others,
+          });
           if (directives) {
-            resultVNode = withDirectives(
-              resultVNode,
-              [
-                ...directives.map((directiveItem) => {
-                  return [
-                    resolveDirective(directiveItem.name),
-                    directiveItem.value,
-                    directiveItem.arg
-                  ]
-                })
-              ]
-            )
+            resultVNode = withDirectives(resultVNode, [
+              ...directives.map((directiveItem) => {
+                return [resolveDirective(directiveItem.name), directiveItem.value, directiveItem.arg];
+              }),
+            ]);
           }
-          return resultVNode
+          return resultVNode;
         })
-      )
-    }
-  }
-})
+      );
+    };
+  },
+});
 </script>
 <style>
-.more-btn{
+.more-btn {
   line-height: 34px;
   font-size: 14px;
-  color:#FF9315;
+  color: #ff9315;
 }
-.dn{
-  display: none!important;
+.dn {
+  display: none !important;
 }
-</style>
+</style>

+ 2 - 1
src/components/byTable/index.vue

@@ -145,7 +145,8 @@
                   ($event) => {
                     handleNativeClick(getAttrsValue(item), $event, item);
                   }
-                " />
+                "
+                :key="scope.row.id" />
             </div>
             <div v-else>
               {{ getValue(scope, item) }}

+ 1 - 1
src/views/group/order/management/index.vue

@@ -420,7 +420,7 @@ const config = computed(() => {
     {
       attrs: {
         label: "操作",
-        width: 180,
+        width: 220,
         align: "center",
         fixed: "right",
       },

+ 1 - 1
src/views/production/schedule/order-inquiry/index.vue

@@ -245,7 +245,7 @@ const config = computed(() => {
     {
       attrs: {
         label: "操作",
-        width: 240,
+        width: 220,
         align: "center",
         fixed: "right",
       },