ysy 1 سال پیش
والد
کامیت
b87b20dd96
3فایلهای تغییر یافته به همراه104 افزوده شده و 39 حذف شده
  1. 9 0
      src/api/saleOrder/index.js
  2. 50 24
      src/views/productionPlan/components/factoryAdd/index.vue
  3. 45 15
      src/views/productionPlan/index.vue

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

@@ -239,3 +239,12 @@ export async function bomRoutingList(id) {
   return Promise.reject(new Error(res.data.message));
 }
 
+//  分厂临时计划修改
+
+export async function temporarilyUpdate(data) {
+  const res = await request.post(`/aps/productionplan/temporarilyUpdate`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 50 - 24
src/views/productionPlan/components/factoryAdd/index.vue

@@ -2,7 +2,6 @@
   <ele-modal
     width="80vw"
     :visible.sync="visible"
-    v-if="visible"
     :close-on-click-modal="false"
     custom-class="ele-dialog-form"
     :title="title"
@@ -255,16 +254,38 @@
   import {
     bomRoutingList,
     bomListByPlan,
-    saveSaleToPlan
+    saveSaleToPlan,
+    temporarilyUpdate
   } from '@/api/saleOrder';
 
   export default {
     components: {
       EquipmentDialog
     },
+    props: {
+      factoryType: {
+        type: Number,
+        default: 1
+      },
+      factoryObj: {
+        type: Object,
+        default: () => {}
+      }
+    },
+    watch: {
+      factoryType: {
+        immediate: true,
+        deep: true,
+        handler(val) {
+          this.type = val;
+          this.title = val == 1 ? '新增临时计划' : '编辑临时计划';
+          this.form = this.factoryObj;
+        }
+      }
+    },
     data() {
       return {
-        visible: false,
+        visible: true,
         title: '',
         type: 1,
 
@@ -317,18 +338,11 @@
       }
     },
     methods: {
-      open(type) {
-        this.type = type;
-        this.title = type == 1 ? '新增临时计划' : '编辑临时计划';
-
-        this.visible = true;
-      },
       handleAdd() {
         this.$refs.equipmentRefs.open();
       },
 
       confirmChoose(list) {
-        console.log(list);
         this.$set(this.form, 'categoryId', list[0].id);
         this.$set(this.form, 'productName', list[0].name);
         this.$set(this.form, 'productCode', list[0].code);
@@ -357,18 +371,31 @@
           if (!valid) {
             return false;
           }
-          await this.getPlanCode();
-
-          this.loading = true;
-          saveSaleToPlan(this.form)
-            .then((res) => {
-              this.$message.success('新增成功!');
-              this.visible = false;
-              this.$emit('close', true);
-            })
-            .finally(() => {
-              this.loading = false;
-            });
+
+          if (this.type == 1) {
+            await this.getPlanCode();
+
+            this.loading = true;
+            saveSaleToPlan(this.form)
+              .then((res) => {
+                this.$message.success('新增成功!');
+                this.$emit('close', true);
+              })
+              .finally(() => {
+                this.loading = false;
+              });
+          } else {
+            
+            this.loading = true;
+            temporarilyUpdate(this.form)
+              .then((res) => {
+                this.$message.success('修改成功!');
+                this.$emit('close', true);
+              })
+              .finally(() => {
+                this.loading = false;
+              });
+          }
         });
       },
 
@@ -428,8 +455,7 @@
       },
 
       cancel() {
-        this.$refs.form.resetFields();
-        this.visible = false;
+        this.$emit('close');
       }
     }
   };

+ 45 - 15
src/views/productionPlan/index.vue

@@ -23,7 +23,11 @@
         <el-button type="danger" size="mini">延期申请</el-button>
         <el-button type="danger" size="mini">变更申请</el-button>
 
-        <el-button type="success" size="mini" v-if="timeDimensionPlanType == 3" @click="factAdd(1)"
+        <el-button
+          type="success"
+          size="mini"
+          v-if="timeDimensionPlanType == 3"
+          @click="factAdd(1)"
           >新增</el-button
         >
       </div>
@@ -199,9 +203,17 @@
 
     <unpackDetails ref="DetailsRef"></unpackDetails>
 
-    <disassemblePlanPop ref="disassemblePlanRef" @close="reload"></disassemblePlanPop>
-
-    <factoryAdd ref="factoryRef"></factoryAdd>
+    <disassemblePlanPop
+      ref="disassemblePlanRef"
+      @close="reload"
+    ></disassemblePlanPop>
+
+    <factoryAdd
+      v-if="factoryShow"
+      :factoryType="factoryType"
+      :factoryObj="factoryObj"
+      @close="factoryClose"
+    ></factoryAdd>
   </div>
 </template>
 
@@ -212,7 +224,7 @@
   import mergeDialog from './components/mergeDialog.vue';
   import unpackDetails from './components/unpackDetails.vue';
   import disassemblePlanPop from './components/disassemblePlanPop.vue';
-  import factoryAdd from './components/factoryAdd/index.vue'
+  import factoryAdd from './components/factoryAdd/index.vue';
   import { release } from '@/api/productionPlan/order.js';
   import { getCode } from '@/api/codeManagement';
   import { fieldModel } from '@/api/saleOrder';
@@ -262,7 +274,11 @@
         ],
         newColumns: [],
 
-        selection: []
+        selection: [],
+
+        factoryShow: false,
+        factoryType: 1,
+        factoryObj: {}
       };
     },
     computed: {
@@ -645,14 +661,20 @@
         // });
       },
       // 修改计划
-      planEdit({ id }) {
-        this.$router.push({
-          path: '/saleOrder/salesToProduction',
-          query: {
-            type: 'edit',
-            id
-          }
-        });
+      planEdit(row) {
+        if (row.timeDimensionPlanType == 3) {
+          this.factoryObj = row;
+          this.factoryType = 2;
+          this.factoryShow = true;
+        } else {
+          this.$router.push({
+            path: '/saleOrder/salesToProduction',
+            query: {
+              type: 'edit',
+              id: row.id
+            }
+          });
+        }
       },
 
       getFieldModel() {
@@ -802,7 +824,15 @@
       },
 
       factAdd(type) {
-        this.$refs.factoryRef.open(type);
+        this.factoryType = type;
+        this.factoryShow = true;
+      },
+
+      factoryClose(val) {
+        this.factoryShow = false;
+        if (val) {
+          this.reload();
+        }
       },
 
       onSortChange(e) {