ysy 1 rok temu
rodzic
commit
d0d6caa450

+ 64 - 0
src/views/byProduct/components/addByProduct.vue

@@ -0,0 +1,64 @@
+<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%"
+  >
+    <div>
+      <el-form :model="productForm" ref="productForm">
+        <el-row :gutter="24">
+          <el-col :span="6">
+            <el-form-item label="处置单号" prop="code" label-width="90px">
+              <el-input v-model="productForm.code" disabled=""></el-input>
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="6">
+            <el-form-item label="处置单名称" prop="name" label-width="90px">
+              <el-input v-model="productForm.name"></el-input>
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="6">
+            <el-button type="primary" @click="selectOrder">选择物料</el-button>
+          </el-col>
+        </el-row>
+      </el-form>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+  import {  getCode } from '@/api/produce/workOrder';
+  export default {
+    data() {
+      return {
+        visible: true,
+
+        productForm: {
+          code: null,
+          name: null
+        }
+      };
+    },
+
+    created() {
+    
+      this.getOrderCode();
+    },
+
+    methods: {
+      handleClose() {
+        this.$emit('close');
+      },
+
+      async getOrderCode() {
+        this.productForm.code = await getCode('dispose_code');
+      },
+    }
+  };
+</script>

+ 33 - 41
src/views/byProduct/index.vue

@@ -1,8 +1,7 @@
 <template>
   <div class="ele-body">
     <el-card shadow="never" v-loading="loading">
-      <productSearch @search="reload" ref="searchRef" >
-      </productSearch>
+      <productSearch @search="reload" ref="searchRef"> </productSearch>
 
       <!-- 数据表格 -->
       <ele-pro-table
@@ -17,47 +16,39 @@
         @update:selection="handleSelectionChange"
       >
         <template v-slot:toolbar>
- 
-          <el-button
-            type="primary"
-          
-            size="mini"
-            @click=""
-            >自建处置单</el-button
-          >
+          <el-button type="primary" size="mini" @click="handByProd">自建处置单</el-button>
         </template>
 
-
         <template v-slot:formedNum="{ row }">
-          {{  row.notFormedNum  || 0 }} /   {{  row.formedNum  || 0 }} 
+          {{ row.notFormedNum || 0 }} / {{ row.formedNum || 0 }}
         </template>
 
         <template v-slot:weight="{ row }">
-          {{  row.weight  || 0 }} /   {{  row.weightUnit   }} 
+          {{ row.weight || 0 }} / {{ row.weightUnit }}
         </template>
 
-
         <template v-slot:action="{ row }">
-          <el-button type="text" size="mini" 
-            >详情</el-button
-          >
+          <el-button type="text" size="mini">详情</el-button>
         </template>
       </ele-pro-table>
     </el-card>
 
+
+    <addByProduct v-if="addByProductShow" @close="close"></addByProduct>
+    
+
   </div>
 </template>
 
 <script>
   import { getPage } from '@/api/byProduct/index';
   import productSearch from './components/product-search.vue';
-
-
+  import  addByProduct from './components/addByProduct.vue';
 
   export default {
     components: {
-      productSearch
-
+      productSearch,
+      addByProduct
     },
 
     data() {
@@ -66,20 +57,16 @@
         loading: false,
         selection: [],
 
-
-
-       
+        addByProductShow: false
       };
     },
     computed: {
       columns() {
         return [
-        
           {
             prop: 'code',
             label: '处置单号',
-            align: 'left',
-            
+            align: 'left'
           },
 
           {
@@ -93,7 +80,6 @@
             align: 'center'
           },
 
-          
           {
             prop: 'categoryCode',
             label: '物品编码',
@@ -106,13 +92,12 @@
             align: 'center'
           },
 
-
           {
             prop: 'formedNum',
             slot: 'formedNum',
             label: '不合格品/合格品数量',
             align: 'center',
-            width: 140,
+            width: 140
           },
 
           {
@@ -120,24 +105,22 @@
             slot: 'weight',
             label: '重量',
             align: 'center',
-            width: 140,
+            width: 140
           },
 
-   
           {
             prop: 'executorName',
             label: '处置人',
             align: 'center',
-            width: 95,
+            width: 95
           },
           {
             prop: 'createTime',
             label: '创建时间',
             align: 'center',
-            width: 95,
+            width: 95
           },
 
-
           {
             prop: '',
             label: '操作',
@@ -154,13 +137,11 @@
     methods: {
       /* 表格数据源 */
       async datasource({ page, limit, where }) {
-
         let parma = {
           ...where,
           pageNum: page,
           size: limit
         };
-    
 
         let res = await getPage(parma);
 
@@ -181,15 +162,26 @@
         };
       },
 
-
-
       handleSelectionChange(data) {
-      console.log(data);
+        console.log(data);
       },
       /* 刷新表格 */
       reload(where = {}) {
         this.$refs.table.reload({ page: 1, where });
-      }
+      },
+
+
+      handByProd() {
+        this.addByProductShow = true;
+      },
+      close(val) {
+        if(val) {
+           this.reload();
+
+        }
+        this.addByProductShow = false;
+      },
+      
     }
   };
 </script>