Parcourir la source

产品分类功能完成

chen il y a 3 ans
Parent
commit
8f93181eaa

+ 8 - 0
src/api/basic_data/material.js

@@ -277,4 +277,12 @@ export function getProductCategoryAddSub(data) {
     method: 'post',
     data
   })
+}
+//删除产品品类小类
+export function getProductCategoryDelSub(params) {
+  return request({
+    url:'/product-category/del-sub',
+    method: 'post',
+    params
+  })
 }

+ 50 - 14
src/views/basic_data/material/classify_list.vue

@@ -34,9 +34,9 @@
                 <el-dropdown-item :command="['edit', v]"
                   >修改名称</el-dropdown-item
                 >
-                <el-dropdown-item :command="['del', v]"
+                <!-- <el-dropdown-item :command="['del', v]"
                   >删除分组</el-dropdown-item
-                >
+                > -->
               </el-dropdown-menu>
             </el-dropdown>
           </div>
@@ -46,27 +46,36 @@
         <!-- 筛选条件 -->
         <div>
           <el-form
-            ref="screenForm"
+            ref="searchForm"
+            :model="searchForm"
             label-width="70px"
             size="small"
             label-position="left"
           >
             <el-row :gutter="20">
               <el-col :xs="24" :sm="12" :lg="6">
-                <el-form-item label="编码" prop="volume">
-                  <el-input placeholder="请输入"></el-input>
+                <el-form-item label="编码" prop="productCategoryNumber">
+                  <el-input
+                    v-model="searchForm.productCategoryNumber"
+                    placeholder="请输入"
+                  ></el-input>
                 </el-form-item>
               </el-col>
               <el-col :xs="24" :sm="12" :lg="6">
-                <el-form-item label="名称" prop="outsideName">
-                  <el-input placeholder="请输入"></el-input>
+                <el-form-item label="名称" prop="productCategoryName">
+                  <el-input
+                    v-model="searchForm.productCategoryName"
+                    placeholder="请输入"
+                  ></el-input>
                 </el-form-item>
               </el-col>
 
               <el-col :xs="24" :sm="24" :lg="12" class="tr">
                 <el-form-item label="">
-                  <el-button size="small">清空</el-button>
-                  <el-button size="small" type="primary">搜索</el-button>
+                  <el-button size="small" @click="clearFn">清空</el-button>
+                  <el-button size="small" type="primary" @click="searchFn"
+                    >搜索</el-button
+                  >
                 </el-form-item>
               </el-col>
             </el-row>
@@ -132,7 +141,7 @@
               </el-table-column>
             </el-table>
           </div>
-          <!-- 分页 -->
+          <!-- 分页
           <div class="fr">
             <el-pagination
               :current-page="currentPage"
@@ -142,7 +151,7 @@
               :total="listTotal"
             >
             </el-pagination>
-          </div>
+          </div> -->
         </div>
       </div>
     </div>
@@ -186,6 +195,7 @@
       :showAddSelect.sync="showAddSelect"
       :data="dataList"
       @updateList="updateListFn"
+      ref="updateDate"
     />
   </div>
 </template>
@@ -197,17 +207,22 @@ import {
   getProductCategorySubList,
   getProductCategoryAdd,
   getProductCategoryEdit,
+  getProductCategoryDelSub,
 } from "@/api/basic_data/material";
 export default {
   data() {
     return {
+      searchForm: {
+        productCategoryNumber: "",
+        productCategoryName: "",
+      },
       addGroupFormVisible: false,
       activeGroup: "",
       dataList: null, // 列表数据
       listLoading: false, // 列表加载loading
-      currentPage: 1, // 当前页码
-      pageSize: 10, // 每页数量
-      listTotal: 0, // 列表总数
+      // currentPage: 1, // 当前页码
+      // pageSize: 10, // 每页数量
+      // listTotal: 0, // 列表总数
       categoryList: [], //品类列表
       addGroupForm: {
         productCategoryName: "",
@@ -225,6 +240,26 @@ export default {
     this.getDataList();
   },
   methods: {
+    //清空
+    clearFn() {
+      this.$refs.searchForm.resetFields();
+    },
+    //搜索
+    searchFn() {
+      this.getDataList({ ...this.searchForm });
+    },
+    //删除
+    async hanleDelete(id) {
+      console.log(this.dataCategory);
+      let arr = [id];
+      let res = arr.toString();
+      await getProductCategoryDelSub({ ids: res });
+      const res2 = await getProductCategorySubList({
+        id: this.dataCategory.productCategoryId,
+      });
+      this.dataList = res2.data;
+      this.$message.success("删除成功");
+    },
     //更新列表
     async updateListFn(id) {
       const res = await getProductCategorySubList({ id });
@@ -232,6 +267,7 @@ export default {
     },
     //添加类别
     async addCategoryFn() {
+      await this.$refs.updateDate.getDataList();
       this.showAddSelect = true;
     },
     //取消

+ 1 - 1
src/views/basic_data/material/components/classify_list-small.vue

@@ -73,7 +73,7 @@ export default {
     };
   },
   created() {
-    this.getDataList();
+    // this.getDataList();
   },
   methods: {
     //获取选择的数据