Procházet zdrojové kódy

修改弹出保存

chencc před 1 rokem
rodič
revize
66c2e89b3d

+ 144 - 174
src/views/materialReturn/components/returnPop.vue

@@ -1,13 +1,6 @@
 <template>
-  <el-dialog
-    title="新建退料单"
-    :visible.sync="visible"
-    :before-close="handleClose"
-    :close-on-click-modal="false"
-    :close-on-press-escape="false"
-    append-to-body
-    width="80%"
-  >
+  <el-dialog title="新建退料单" :visible.sync="visible" :before-close="handleClose" :close-on-click-modal="false"
+    :close-on-press-escape="false" append-to-body width="80%">
     <div>
       <el-form :model="returnForm" ref="returnForm">
         <el-row :gutter="24">
@@ -26,12 +19,7 @@
           <el-col :span="8">
             <el-form-item label="退料场景" prop="scene" label-width="90px">
               <el-select v-model="returnForm.scene" :disabled="Boolean(returnDetailsId)" placeholder="请选择">
-                <el-option
-                  v-for="item in sceneList"
-                  :key="item.value"
-                  :label="item.label"
-                  :value="item.value"
-                >
+                <el-option v-for="item in sceneList" :key="item.value" :label="item.label" :value="item.value">
                 </el-option>
               </el-select>
             </el-form-item>
@@ -46,9 +34,7 @@
           </el-col>
 
           <el-col :span="4">
-            <el-button type="primary" @click="selectOrder" v-if="!Boolean(returnDetailsId)"
-              >选择领料单</el-button
-            >
+            <el-button type="primary" @click="selectOrder" v-if="!Boolean(returnDetailsId)">选择领料单</el-button>
           </el-col>
         </el-row>
       </el-form>
@@ -68,16 +54,8 @@
         </div>
 
         <div>
-          <el-table
-            :ref="`form${idx}`"
-            class="table_content"
-            :max-height="300"
-            :data="item.pickOutInList"
-            tooltip-effect="dark"
-            style="width: 100%"
-            stripe
-            border
-          >
+          <el-table :ref="`form${idx}`" class="table_content" :max-height="300" :data="item.pickOutInList"
+            tooltip-effect="dark" style="width: 100%" stripe border>
             <el-table-column label="序号" type="index" width="60">
               <template slot-scope="{ row, $index }">
                 {{ $index }}
@@ -97,21 +75,13 @@
             <el-table-column label="规格" prop="specification">
             </el-table-column>
 
-            <el-table-column
-              label="刻码"
-              prop="engrave"
-              v-if="clientEnvironmentId == 3"
-            >
+            <el-table-column label="刻码" prop="engrave" v-if="clientEnvironmentId == 3">
               <template slot-scope="{ row, $index }">
                 {{ row.extInfo.engrave }}
               </template>
             </el-table-column>
 
-            <el-table-column
-              label="物料代号"
-              prop="materielCode"
-              v-if="clientEnvironmentId == 3"
-            >
+            <el-table-column label="物料代号" prop="materielCode" v-if="clientEnvironmentId == 3">
               <template slot-scope="{ row, $index }">
                 {{ row.extInfo.materielCode }}
               </template>
@@ -130,9 +100,7 @@
 
             <el-table-column label="操作" fixed="right" width="100px" v-if="!Boolean(returnDetailsId)">
               <template slot-scope="{ $index, row }">
-                <el-link type="danger" @click="removeItem(idx, $index)"
-                  >删除</el-link
-                >
+                <el-link type="danger" @click="removeItem(idx, $index)">删除</el-link>
               </template>
             </el-table-column>
           </el-table>
@@ -142,113 +110,112 @@
 
     <template slot="footer">
       <el-button size="mini" @click="handleClose">取 消</el-button>
-      <el-button size="mini"  v-click-once type="primary" @click="save()">确 定</el-button>
+      <el-button size="mini" v-click-once type="primary" @click="save()">确 定</el-button>
     </template>
 
-    <pickList
-      v-if="pickListShow"
-      @closeDialog="closeDialog"
-      @emitSave="emitSave"
-    ></pickList>
+    <pickList v-if="pickListShow" @closeDialog="closeDialog" @emitSave="emitSave"></pickList>
   </el-dialog>
 </template>
 
 <script>
-  import { getCode } from '@/api/produce/workOrder';
-  import { refundable, save, getById } from '@/api/materialReturn/index.js';
-  import pickList from './pickList.vue';
-
-  import { typeName } from '@/views/produce/components/common.js';
-  export default {
-    components: { pickList },
-    props: {
-      sceneList: {
-        type: Array,
-        default() {
-          return [];
-        }
-      },
-      returnDetailsId: {
-        type: String,
-        default: ''
+import { getCode } from '@/api/produce/workOrder';
+import { refundable, save, getById } from '@/api/materialReturn/index.js';
+import pickList from './pickList.vue';
+
+import { typeName } from '@/views/produce/components/common.js';
+export default {
+  components: { pickList },
+  props: {
+    sceneList: {
+      type: Array,
+      default() {
+        return [];
       }
     },
-    data() {
-      return {
-        visible: true,
+    returnDetailsId: {
+      type: String,
+      default: ''
+    }
+  },
+  data() {
+    return {
+      visible: true,
+
+      returnForm: {
+        code: '',
+        name: '',
+        scene: '',
+        remark: '',
+        type: 1
+      },
 
-        returnForm: {
-          code: '',
-          name: '',
-          scene: '',
-          remark: '',
-          type: 1
-        },
+      typeName,
 
-        typeName,
+      pickListShow: false,
 
-        pickListShow: false,
+      returnList: []
+    };
+  },
 
-        returnList: []
-      };
-    },
+  computed: {
+    clientEnvironmentId() {
+      return this.$store.state.user.info.clientEnvironmentId;
+    }
+  },
 
-    computed: {
-      clientEnvironmentId() {
-        return this.$store.state.user.info.clientEnvironmentId;
-      }
+  created() {
+
+    if (this.returnDetailsId) {
+      this.getDetails()
+    } else {
+      this.getOrderCode();
+    }
+  },
+
+  methods: {
+    async getOrderCode() {
+      this.returnForm.code = await getCode('return_materials_code');
     },
 
-    created() {
-    
-      if(this.returnDetailsId) {
-        this.getDetails()
-      } else {
-        this.getOrderCode();
-      }
+    selectOrder() {
+      this.pickListShow = true;
     },
 
-    methods: {
-      async getOrderCode() {
-        this.returnForm.code = await getCode('return_materials_code');
-      },
+    closeDialog() {
+      this.pickListShow = false;
+    },
 
-      selectOrder() {
-        this.pickListShow = true;
-      },
+    handleClose() {
+      this.$emit('close');
+    },
 
-      closeDialog() {
+    emitSave(pickIds) {
+      refundable(pickIds).then((res) => {
+        this.returnList = res;
+        this.$forceUpdate();
         this.pickListShow = false;
-      },
-
-      handleClose() {
-        this.$emit('close');
-      },
-
-      emitSave(pickIds) {
-        refundable(pickIds).then((res) => {
-          this.returnList = res;
-          this.$forceUpdate();
-          this.pickListShow = false;
-        });
-      },
+      });
+    },
 
-      removeItem(idx, index) {
-        if (this.returnList[idx].pickOutInList.length != 1) {
-          this.returnList[idx].pickOutInList.splice(index, 1);
-        } else {
-          this.$message.warning('领料单中必须保留一条数据');
-        }
-      },
+    removeItem(idx, index) {
+      if (this.returnList[idx].pickOutInList.length != 1) {
+        this.returnList[idx].pickOutInList.splice(index, 1);
+      } else {
+        this.$message.warning('领料单中必须保留一条数据');
+      }
+    },
 
-      save() {
-        if (!this.returnForm.name) {
-          return this.$message.warning('请输入退料单名称');
-        }
-        if (this.returnList.length == 0) {
-          return this.$message.warning('请选择领料单');
-        }
+    save() {
+      if (!this.returnForm.name) {
+        return this.$message.warning('请输入退料单名称');
+      }
+      if (this.returnList.length == 0) {
+        return this.$message.warning('请选择领料单');
+      }
 
+      if (this.returnDetailsId) {
+        this.$emit('close', true);
+      } else {
         let parma = {
           ...this.returnForm,
           pickOrderList: this.returnList
@@ -257,68 +224,71 @@
         save(parma).then((res) => {
           this.$emit('close', true);
         });
-      },
+      }
 
-      getDetails() {
-        getById(this.returnDetailsId).then((res) => {
-            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()
-        })
-      },
-    }
-  };
+    },
+
+    getDetails() {
+      getById(this.returnDetailsId).then((res) => {
+        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>
 
 <style lang="scss" scoped>
-  .tableZ_box {
-    border: 1px solid #e3e5e5;
-    margin: 6px 0;
+.tableZ_box {
+  border: 1px solid #e3e5e5;
+  margin: 6px 0;
 
-    &:last-child {
-      border-bottom: none;
-    }
+  &:last-child {
+    border-bottom: none;
+  }
 
-    .row {
-      width: 100%;
-      display: flex;
+  .row {
+    width: 100%;
+    display: flex;
+  }
+
+  .col {
+    width: calc(100% / 3);
+    display: flex;
+    align-items: center;
+    min-width: 200px;
+    min-height: 32px;
+    border-bottom: 1px solid #e3e5e5;
+    border-right: 1px solid #e3e5e5;
+
+    &:last-child {
+      border-right: none;
     }
 
-    .col {
-      width: calc(100% / 3);
+    .name {
       display: flex;
       align-items: center;
-      min-width: 200px;
-      min-height: 32px;
-      border-bottom: 1px solid #e3e5e5;
-      border-right: 1px solid #e3e5e5;
-
-      &:last-child {
-        border-right: none;
-      }
-
-      .name {
-        display: flex;
-        align-items: center;
-        padding: 4px;
-        width: 120px;
-        height: 100%;
-        background-color: #d0e4d5;
-        color: #000;
-      }
-
-      .content {
-        padding: 4px 6px;
-        color: #000;
-      }
+      padding: 4px;
+      width: 120px;
+      height: 100%;
+      background-color: #d0e4d5;
+      color: #000;
     }
 
-    .pd6 {
-      padding: 0 6px;
+    .content {
+      padding: 4px 6px;
+      color: #000;
     }
   }
+
+  .pd6 {
+    padding: 0 6px;
+  }
+}
 </style>

+ 2 - 0
src/views/materialReturn/index.vue

@@ -133,6 +133,7 @@
         return res;
       },
 
+      // 新增退料
       handleReturn() {
         this.returnDetailsId = null;
         this.returnShow = true;
@@ -146,6 +147,7 @@
         this.returnShow = false;
       },
 
+      //查看详情
       handDetailed(row) {
         this.returnDetailsId = row.id;
         this.returnShow = true;