ysy 1 год назад
Родитель
Сommit
0fe59d7c18

+ 11 - 0
src/api/productionPlan/index.js

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

+ 10 - 0
src/api/saleOrder/index.js

@@ -192,3 +192,13 @@ export async function getInventory(materialCode, planType) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+// 修改优先级
+export async function updatePriority(data) {
+  const res = await request.post(`/aps/salesorder/updatePriority`,  data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+

+ 9 - 0
src/api/workOrder/index.js

@@ -25,3 +25,12 @@ export async function releaseWorkOrder({ id, teamId }) {
 }
 
 
+// 修改优先级
+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));
+}
+

+ 16 - 2
src/views/productionPlan/index.vue

@@ -98,7 +98,7 @@
 </template>
 
 <script>
-  import { getList, del } from '@/api/productionPlan/index.js';
+  import { getList, del, updatePriority } from '@/api/productionPlan/index.js';
   import productionPlanSearch from './components/productionPlan-search.vue';
   import { release } from '@/api/productionPlan/order.js';
   import { multiply } from '@/utils/math';
@@ -229,6 +229,14 @@
             align: 'center',
             showOverflowTooltip: true
           },
+          {
+            prop: 'batchNo',
+            label: '批号',
+            align: 'center',
+            minWidth: 100,
+            showOverflowTooltip: true
+          },
+
           {
             prop: 'priority',
             label: '优先级',
@@ -450,7 +458,13 @@
       },
 
       priorityFn: debounce(function (row) {
-        console.log(2, row);
+        let params = { 
+          id: row.id,
+          priority: row.priority
+        }
+        updatePriority(params).then((res) => {
+         
+        })
       }, 800)
     }
   };

+ 8 - 2
src/views/saleOrder/index.vue

@@ -83,7 +83,7 @@
   import OrderSearch from './components/order-search.vue';
   import OrderDetail from './components/order-detail.vue';
   import CreateOrder from './components/create-order.vue';
-  import { getPageList, deleteOrder } from '@/api/saleOrder';
+  import { getPageList, deleteOrder, updatePriority } from '@/api/saleOrder';
   import dictMixins from '@/mixins/dictMixins';
   import { debounce } from 'lodash';
   export default {
@@ -362,7 +362,13 @@
       },
 
       priorityFn: debounce(function (row) {
-        console.log(2, row);
+        let params = { 
+          id: row.id,
+          priority: row.priority
+        }
+        updatePriority(params).then((res) => {
+         
+        })
       }, 800)
     }
   };

+ 62 - 2
src/views/workOrder/index.vue

@@ -22,6 +22,20 @@
           {{ row.formingWeight }} {{ row.newWeightUnit }}
         </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>
+
 
 
         
@@ -65,9 +79,10 @@
 </template>
 
 <script>
-  import { getList, releaseWorkOrder } from '@/api/workOrder/index.js';
+  import { getList, releaseWorkOrder, updatePriority } from '@/api/workOrder/index.js';
   import { teamPage } from '@/api/mainData/index.js';
   import OrderSearch from './components/order-search.vue';
+  import { debounce } from 'lodash';
   export default {
     components: {
       OrderSearch
@@ -142,6 +157,24 @@
             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: '要求生产数量',
@@ -276,7 +309,34 @@
         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>