ysy 1 年之前
父节点
当前提交
e90a17fef4
共有 3 个文件被更改,包括 76 次插入38 次删除
  1. 11 1
      src/api/materialReturn/index.js
  2. 32 8
      src/views/materialReturn/components/returnPop.vue
  3. 33 29
      src/views/materialReturn/index.vue

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

@@ -5,7 +5,9 @@ import request from '@/utils/request';
  * 列表
  */
 export async function returnPage(params) {
-  const res = await request.get('/mes/returnmaterials/page',  { params });
+  const res = await request.get('/mes/returnmaterials/page', {
+    params
+  });
   if (res.data.code == 0) {
     return res.data.data;
   }
@@ -33,3 +35,11 @@ export async function save(data) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+export async function getById(id) {
+  const res = await request.get(`/mes/returnmaterials/getById/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 32 - 8
src/views/materialReturn/components/returnPop.vue

@@ -19,13 +19,13 @@
 
           <el-col :span="6">
             <el-form-item label="退料单名称" prop="name" label-width="90px">
-              <el-input v-model="returnForm.name"></el-input>
+              <el-input v-model="returnForm.name" :disabled="returnDetailsId"></el-input>
             </el-form-item>
           </el-col>
 
           <el-col :span="8">
             <el-form-item label="退料场景" prop="scene" label-width="90px">
-              <el-select v-model="returnForm.scene" placeholder="请选择">
+              <el-select v-model="returnForm.scene" :disabled="returnDetailsId" placeholder="请选择">
                 <el-option
                   v-for="item in sceneList"
                   :key="item.value"
@@ -41,12 +41,12 @@
         <el-row :gutter="24">
           <el-col :span="20">
             <el-form-item label="退料描述" prop="remark" label-width="90px">
-              <el-input v-model="returnForm.remark"></el-input>
+              <el-input v-model="returnForm.remark" :disabled="returnDetailsId"></el-input>
             </el-form-item>
           </el-col>
 
           <el-col :span="4">
-            <el-button type="primary" @click="selectOrder"
+            <el-button type="primary" @click="selectOrder" v-if="!returnDetailsId"
               >选择领料单</el-button
             >
           </el-col>
@@ -128,7 +128,7 @@
               </template>
             </el-table-column>
 
-            <el-table-column label="操作" fixed="right" width="100px">
+            <el-table-column label="操作" fixed="right" width="100px" v-if="!returnDetailsId">
               <template slot-scope="{ $index, row }">
                 <el-link type="danger" @click="removeItem(idx, $index)"
                   >删除</el-link
@@ -155,7 +155,7 @@
 
 <script>
   import { getCode } from '@/api/produce/workOrder';
-  import { refundable, save } from '@/api/materialReturn/index.js';
+  import { refundable, save, getById } from '@/api/materialReturn/index.js';
   import pickList from './pickList.vue';
 
   import { typeName } from '@/views/produce/components/common.js';
@@ -167,6 +167,10 @@
         default() {
           return [];
         }
+      },
+      returnDetailsId: {
+        type: String,
+        default: ''
       }
     },
     data() {
@@ -196,7 +200,12 @@
     },
 
     created() {
-      this.getOrderCode();
+    
+      if(this.returnDetailsId) {
+        this.getDetails()
+      } else {
+        this.getOrderCode();
+      }
     },
 
     methods: {
@@ -248,7 +257,22 @@
         save(parma).then((res) => {
           this.$emit('close', true);
         });
-      }
+      },
+
+      getDetails() {
+        getById(this.returnDetailsId).then((res) => {
+            console.log(res, 99);
+            this.returnForm.code = res.code
+            this.returnForm.name = res.name
+            this.returnForm.remark = res.remark
+            this.returnForm.scene = res.scene
+            this.returnList = res.pickOrderList
+
+
+
+            this.$forceUpdate()
+        })
+      },
     }
   };
 </script>

+ 33 - 29
src/views/materialReturn/index.vue

@@ -18,11 +18,9 @@
           >
         </template>
 
-
         <template v-slot:scene="{ row }">
-     {{ row.scene }}
-          </template>
-
+          {{ sceneListFn(row.scene) }}
+        </template>
 
         <template v-slot:action="{ row }">
           <el-button type="text" size="mini" @click="handDetailed(row)"
@@ -32,7 +30,12 @@
       </ele-pro-table>
     </el-card>
 
-    <returnPop v-if="returnShow" @close="close" :sceneList="sceneList"></returnPop>
+    <returnPop
+      v-if="returnShow"
+      :returnDetailsId="returnDetailsId"
+      @close="close"
+      :sceneList="sceneList"
+    ></returnPop>
   </div>
 </template>
 
@@ -56,14 +59,14 @@
         selection: [],
 
         returnShow: false,
+        returnDetailsId: null ,
 
-        sceneList: [],
+        sceneList: []
       };
     },
     computed: {
       columns() {
         return [
-
           {
             prop: 'code',
             label: '退料单编号',
@@ -129,6 +132,7 @@
       },
 
       handleReturn() {
+        this.returnDetailsId = null
         this.returnShow = true;
       },
 
@@ -136,36 +140,36 @@
         if (val) {
           this.reload();
         }
+        this.returnDetailsId = null;
         this.returnShow = false;
       },
 
-      handDetailed(row) {},
-
+      handDetailed(row) {
+        this.returnDetailsId = row.id
+        this.returnShow = true
+      },
 
       getByCodeFn() {
-      getByCode('returnScenario').then((res) => {
-        let _arr = [];
-        res.data.map((item) => {
-          const key = Object.keys(item)[0];
-          const value = item[key];
-
-          _arr.push({ name: key, value: value });
+        getByCode('returnScenario').then((res) => {
+          let _arr = [];
+          res.data.map((item) => {
+            const key = Object.keys(item)[0];
+            const value = item[key];
+            _arr.push({ label: value, value: key });
+          });
+
+          this.sceneList = _arr;
         });
-   
-        this.sceneList = _arr;
-      });
-    },
+      },
 
-    sceneListFn(val) {
-      let _arr = this.sceneList;
-      for (const item of _arr) {
-        console.log(item.value, val);
-        if (item.value == val) {
-          return item.name;
+      sceneListFn(val) {
+        let _arr = this.sceneList;
+        for (const item of _arr) {
+          if (item.value == val) {
+            return item.label;
+          }
         }
-      }
-    },
-
+      },
 
       /* 刷新表格 */
       reload(where = {}) {