ysy пре 1 година
родитељ
комит
d1f399e31d
1 измењених фајлова са 40 додато и 25 уклоњено
  1. 40 25
      src/views/material/BOMmanage/components/detailedList.vue

+ 40 - 25
src/views/material/BOMmanage/components/detailedList.vue

@@ -1,10 +1,6 @@
 <template>
   <div class="ele-body">
-    <BOMSearch
-      @search="reload"
-      :statusOpt="statusOpt"
-     
-    />
+    <BOMSearch @search="reload" :statusOpt="statusOpt" />
     <ele-pro-table
       ref="table"
       :columns="columns"
@@ -15,10 +11,14 @@
     >
       <template v-slot:toolbar>
         <div class="toolbar_box">
-         <div>
-          <el-button type="primary" size="mini" @click="handleAdd">新增</el-button>
-          <el-button type="primary" size="mini" @click="handleAdd">保存</el-button>
-         </div>
+          <div>
+            <el-button type="primary" size="mini" @click="handleAdd"
+              >新增</el-button
+            >
+            <el-button type="primary" size="mini" @click="handleAdd"
+              >保存</el-button
+            >
+          </div>
           <div class="toolbar_box_right"
             ><span>基本数量</span>
             <el-input
@@ -36,7 +36,7 @@
           v-model="row.dosage"
           placeholder="请输入"
           size="mini"
-          style="width: 68px;"
+          style="width: 68px"
         >
         </el-input>
       </template>
@@ -99,23 +99,31 @@
 
       <!-- 表头工具栏 -->
       <template v-slot:action="{ row }">
-        <el-link type="danger" :underline="false" icon="el-icon-delete" @click="handleDel(row)">
+        <el-link
+          type="danger"
+          :underline="false"
+          icon="el-icon-delete"
+          @click="handleDel(row)"
+        >
           删除
         </el-link>
       </template>
     </ele-pro-table>
 
     <bomTreeDialog ref="bomTreeDialogRef" @reload="bomClose" />
-
   </div>
 </template>
 
 <script>
   import BOMSearch from './BOM-search.vue';
-  import { getBomPageCategoryId, contactList } from '@/api/material/BOM';
+  import {
+    getBomPageCategoryId,
+    contactList,
+    deleteBomTreeList
+  } from '@/api/material/BOM';
   import { getByCode } from '@/api/system/dictionary-data';
 
-  import bomTreeDialog  from './bomTreeDialog.vue'
+  import bomTreeDialog from './bomTreeDialog.vue';
   export default {
     name: 'SystemDictionary',
     components: { BOMSearch, bomTreeDialog },
@@ -264,12 +272,9 @@
       treeId: {
         type: String,
         default: ''
-      },
-
+      }
     },
 
-  
-
     watch: {
       attributeData(val) {
         this.attrObj = val;
@@ -283,7 +288,7 @@
 
       treeId(val) {
         this.newTreeId = val;
-      },
+      }
     },
 
     methods: {
@@ -318,7 +323,6 @@
         });
       },
 
-      
       getContactList() {
         let param = {
           pageNum: 1,
@@ -338,11 +342,10 @@
           this.attributeData.versions,
           this.attributeData.categoryId,
           this.newTreeId
-        )
+        );
       },
 
       bomClose() {
-        this.$refs.table.setData([]);
         this.$nextTick(() => {
           this.$refs.table.reload({
             pageNum: 1
@@ -351,9 +354,21 @@
       },
 
       handleDel(row) {
-        console.log(row)
-      },
-
+        this.$confirm('是否确认删除?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        })
+          .then(() => {
+            deleteBomTreeList([row.id]).then((msg) => {
+              this.$message.success('删除' + msg);
+              this.$refs.table.reload({
+                pageNum: 1
+              });
+            });
+          })
+          .finally(() => {});
+      }
     }
   };
 </script>