ysy hace 1 año
padre
commit
50803bb301

+ 10 - 1
src/api/produceOrder/index.js

@@ -161,4 +161,13 @@ export async function queryPrint (data) {
     return res.data.data;
   }
   return Promise.reject(new Error(res.data.message));
-}
+}
+
+// 修改优先级
+export async function updatePriority(data) {
+  const res = await request.post(`/mes/workorder/updatePriority`,  data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 11 - 1
src/api/produceWord/index.js

@@ -36,4 +36,14 @@ export async function getteampage(data) {
       return res.data.data;
   }
   return Promise.reject(new Error(res.data.message));
-}
+}
+
+// 修改优先级
+export async function updatePriority(data) {
+  const res = await request.post(`/aps/workorder/updatePriority`,  data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+

+ 15 - 0
src/styles/transition/common.scss

@@ -82,3 +82,18 @@
     margin-bottom: 0 !important;
   }
 }
+
+.sort-wrap {
+  i {
+    font-size: 24px;
+    cursor: pointer;
+  }
+
+  .el-icon-caret-top {
+    color: red;
+  }
+
+  .el-icon-caret-bottom {
+    color: #157a2c;
+  }
+}

+ 59 - 2
src/views/produceOrder/index.vue

@@ -42,6 +42,19 @@
         </template>
 
 
+        <template v-slot:priority="{ row }">
+       <el-input
+         v-model="row.priority"
+         type="number"
+         size="mini"
+         @change="priorityChange(row)"
+       ></el-input>
+       <div class="sort-wrap">
+         <i class="el-icon-caret-top" @click="sortTop(row)"></i>
+         <i class="el-icon-caret-bottom" @click="sortBottom(row)"></i>
+       </div>
+
+     </template>
 
         <template v-slot:status="{ row }">
           <span :class="{ 'ele-text-danger': row.status == 3 }">
@@ -87,7 +100,7 @@ import {
   getPage,
   batchCompletion,
   cancelCompletion,
-
+  updatePriority
 } from '@/api/produceOrder/index.js';
 import produceOrderSearch from './components/produceOrder-search.vue';
 import createDialog from './components/createDialog.vue';
@@ -96,7 +109,7 @@ import pickingDialog from './components/pickingDialog.vue';
 import print from './components/print.vue';
 import printSr from './components/printSr'
 import printTg from './components/printTg'
-
+import { debounce } from 'lodash';
 
 export default {
   components: {
@@ -240,6 +253,23 @@ export default {
           label: '型号',
           align: 'center'
         },
+        {
+            prop: 'batchNo',
+            label: '批号',
+            align: 'center',
+            minWidth: 100,
+            showOverflowTooltip: true
+          },
+
+          {
+            prop: 'priority',
+            label: '优先级',
+            align: 'center',
+            minWidth: 120,
+            slot: 'priority',
+            sortable: true
+          },
+
         {
           prop: 'formingNum',
           label: '要求生产数量',
@@ -548,6 +578,33 @@ export default {
     },
 
 
+    sortTop(row) {
+        row.priority = Number(row.priority) + 1;
+        this.priorityChange(row);
+      },
+      sortBottom(row) {
+        if (row.priority <= 1) {
+          return;
+        }
+        row.priority = Number(row.priority) - 1;
+        this.priorityChange(row);
+      },
+
+      priorityChange(row) {
+        this.priorityFn(row);
+      },
+
+      priorityFn: debounce(function (row) {
+        let params = { 
+          id: row.id,
+          priority: row.priority
+        }
+        updatePriority(params).then((res) => {
+         
+        })
+      }, 800)
+
+
 
 
 

+ 67 - 2
src/views/produceWord/index.vue

@@ -15,6 +15,23 @@
           {{ row.code }}
           <!-- </el-link> -->
         </template>
+
+        <template v-slot:priority="{ row }">
+       <el-input
+         v-model="row.priority"
+         type="number"
+         size="mini"
+         @change="priorityChange(row)"
+       ></el-input>
+       <div class="sort-wrap">
+         <i class="el-icon-caret-top" @click="sortTop(row)"></i>
+         <i class="el-icon-caret-bottom" @click="sortBottom(row)"></i>
+       </div>
+
+     </template>
+
+
+
         <template v-slot:status="{ row }">
           <span :class="{ 'ele-text-danger': row.status == 3 }">
             {{ statusFormatter(row.status) }}
@@ -44,9 +61,10 @@
 </template>
 
 <script>
-  import { getList, releaseWorkOrder } from '@/api/produceWord/index.js';
+  import { getList, releaseWorkOrder, updatePriority } from '@/api/produceWord/index.js';
 
   import OrderSearch from './components/order-search.vue';
+  import { debounce } from 'lodash';
   export default {
     components: {
       OrderSearch
@@ -119,6 +137,25 @@
             label: '型号',
             align: 'center'
           },
+
+          {
+            prop: 'batchNo',
+            label: '批号',
+            align: 'center',
+            minWidth: 100,
+            showOverflowTooltip: true
+          },
+
+          {
+            prop: 'priority',
+            label: '优先级',
+            align: 'center',
+            minWidth: 120,
+            slot: 'priority',
+            sortable: true
+          },
+
+
           {
             prop: 'formingNum',
             label: '要求生产数量',
@@ -222,7 +259,35 @@
         this.$nextTick(() => {
           this.$refs.table.reload({ page: 1, where });
         });
-      }
+      },
+
+      
+      sortTop(row) {
+        row.priority = Number(row.priority) + 1;
+        this.priorityChange(row);
+      },
+      sortBottom(row) {
+        if (row.priority <= 1) {
+          return;
+        }
+        row.priority = Number(row.priority) - 1;
+        this.priorityChange(row);
+      },
+
+      priorityChange(row) {
+        this.priorityFn(row);
+      },
+
+      priorityFn: debounce(function (row) {
+        let params = { 
+          id: row.id,
+          priority: row.priority
+        }
+        updatePriority(params).then((res) => {
+         
+        })
+      }, 800)
+
     }
   };
 </script>