ysy 2 лет назад
Родитель
Сommit
723e07f8c9

+ 10 - 6
src/api/inspectionClassify/index.js

@@ -4,13 +4,17 @@ import request from '@/utils/request';
 
 
 // 列表 
-export async function getList (params) {
-    const res = await request.get(`/qms/qualitylevel/page?`, params);
-    if (res.data.code == 0) {
-      return res.data.data;
-    }
-    return Promise.reject(new Error(res.data.message));
+
+export async function getList (data) {
+  let par = new URLSearchParams(data);
+  const res = await request.get(`/qms/qualitylevel/page?` + par, {});
+  if (res.data.code == 0) {
+    return res.data.data;
   }
+  return Promise.reject(new Error(res.data.message));
+}
+
+
   
 
   export async function getById(id) {

+ 22 - 18
src/views/inspectionClassify/components/user-list.vue

@@ -77,7 +77,7 @@ export default {
   components: { userSearch, Add, Edit },
   props: {
     // 类别id
-    categoryId: [Number, String],
+
     rootId: [Number, String],
   },
   data() {
@@ -98,21 +98,24 @@ export default {
         },
 
         {
-          prop: 'name',
-          label: '标准名称',
+          prop: 'code',
+          label: '标准编码',
           showOverflowTooltip: true,
           minWidth: 110,
-          slot: 'name',
+          slot: 'code',
         },
 
+
+
         {
-          prop: 'code',
-          label: '标准编码',
+          prop: 'name',
+          label: '标准名称',
           showOverflowTooltip: true,
           minWidth: 110,
-          slot: 'code',
+          slot: 'name',
         },
 
+ 
 
         {
           prop: 'status',
@@ -163,19 +166,18 @@ export default {
         ...where,
         pageNum: page,
         size: limit,
-        categoryLevelId: this.categoryId,
+        categoryLevelId: this.categoryLevelId || 12,
         rootCategoryLevelId: this.rootId
       });
     },
     /* 刷新表格 */
     reload(where) {
-
-      this.$refs.table.reload({ pageNum: 1, where: where ,  categoryLevelId: this.categoryId,  rootCategoryLevelId: this.rootId});
+      this.$refs.table.reload({ pageNum: 1, where: where ,  categoryLevelId: this.categoryLevelId ,  rootCategoryLevelId: this.rootId});
     },
 
     /* 打开编辑弹窗 */
     openAdd() {
-      this.$refs.addRef.open(this.categoryId);
+      this.$refs.addRef.open(this.categoryLevelId);
     },
 
     openEdit(row) {
@@ -209,16 +211,18 @@ export default {
     },
     done() {
       this.$refs.searchRef.search();
-    }
+    },
+
+    clickSearch(info){
+      this.categoryLevelId = info.id 
+      this.rootCategoryLevelId = info.rootCategoryLevelId
+      this.reload()
+
+    },
 
 
 
   },
-  watch: {
-    // 监听类别id变化
-    categoryId() {
-      this.reload();
-    }
-  }
+
 };
 </script>

+ 2 - 1
src/views/inspectionClassify/index.vue

@@ -8,7 +8,7 @@
           </div>
         </div>
         <template v-slot:content>
-          <user-list v-if="current" :category-id="current.id" :root-id="rootId" />
+          <user-list v-if="current" :category-id="current.id" :root-id="rootId" ref="searchRef" />
         </template>
       </ele-split-layout>
     </el-card>
@@ -38,6 +38,7 @@ export default {
   methods: {
     handleNodeClick(info) {
       this.current = info;
+      this.$refs.searchRef.clickSearch(info)
     },
     // 获取根节点id
     setRootId(id) {