ysy 1 anno fa
parent
commit
be04a8a4f1

+ 3 - 0
src/utils/eventBus.js

@@ -0,0 +1,3 @@
+// eventBus.js
+import Vue from 'vue';
+export const EventBus = new Vue()

+ 21 - 11
src/views/material/BOMmanage/qualityTesting/inspectionClassify/components/edit.vue

@@ -16,7 +16,11 @@
         :data="form.parameterStandards"
         border
         height="40vh"
+        @selection-change="handleSelectionChange"
       >
+        <el-table-column type="selection" align="center" width="55">
+        </el-table-column>
+
         <el-table-column :label="form.singleWeightDivision" align="center">
           <el-table-column
             label="参数上限"
@@ -67,6 +71,7 @@
             </template>
           </el-table-column>
         </el-table-column>
+
         <el-table-column :label="form.tolerance" align="center">
           <el-table-column label="质检标准" align="center">
             <template slot-scope="scope">
@@ -96,12 +101,7 @@
 
     <template v-slot:footer>
       <el-button @click="handleClose">取消</el-button>
-      <el-button
-        type="primary"
-        :loading="loading"
-        @click="save"
-        v-if="type != 'detail'"
-      >
+      <el-button type="primary" :loading="loading" @click="save">
         保存
       </el-button>
     </template>
@@ -109,6 +109,7 @@
 </template>
 
 <script>
+  import { EventBus } from '@/utils/eventBus';
   export default {
     components: {},
 
@@ -129,13 +130,18 @@
         visible: false,
 
         type: '',
-        loading: false
+        loading: false,
+
+        multipleSelection: [],
+        rowObj: {}
       };
     },
 
     created() {},
     methods: {
-      open(type, row) {
+      open(type, rowItem) {
+        this.rowObj = rowItem;
+        let row = rowItem.qualityStandard || {};
         this.type = type;
         if (this.type != 'add') {
           row.linePoints = row.linePoints || [];
@@ -152,11 +158,15 @@
         this.visible = true;
       },
 
-      handleDeleteItem(index, list) {
-        this.form[list].splice(index, 1);
+      handleSelectionChange(val) {
+        this.multipleSelection = val;
       },
+
       /* 保存编辑 */
-      save() {},
+      save() {
+        this.rowObj.qualityStandard.parameterStandards = this.multipleSelection;
+        EventBus.$emit('inspectionSelection', { message: this.rowObj });
+      },
       restForm() {
         this.form = { ...this.defaultForm() };
         this.$nextTick(() => {

+ 2 - 3
src/views/material/BOMmanage/qualityTesting/inspectionClassify/components/user-list.vue

@@ -20,7 +20,7 @@
 
       <template v-slot:code="{ row }">
         <el-link
-          @click="openDetail(row.qualityStandard)"
+          @click="openDetail(row)"
           type="primary"
           :underline="false"
         >
@@ -143,8 +143,7 @@
           rootCategoryLevelId: this.rootId
         });
 
-    
-        console.log(_data,555);
+   
         return _data
       },
       /* 刷新表格 */

+ 20 - 10
src/views/material/BOMmanage/qualityTesting/term.vue

@@ -1,20 +1,30 @@
 <template>
-    <div>
-        质检项
-        <el-button @click="() => this.$refs.termRef.open()">弹出</el-button>
+  <div>
+    <el-button @click="() => this.$refs.termRef.open()"size="small" type="primary">新增</el-button>
 
-        <termPop ref="termRef"></termPop>
-    </div>
+
+    
+
+    <termPop ref="termRef"></termPop>
+  </div>
 </template>
 
 <script>
-import termPop from './inspectionClassify/index.vue'
-export default {
+  import termPop from './inspectionClassify/index.vue';
+  import { EventBus } from '@/utils/eventBus';
+  export default {
     components: { termPop },
     data() {
-        return {};
+      return {};
     },
-};
+
+    created() {
+
+      EventBus.$on('inspectionSelection', (data) => {
+        console.log(data.message); 
+      });
+    }
+  };
 </script>
 
-<style lang="scss" scoped></style>
+<style lang="scss" scoped></style>