Ver Fonte

工艺绑定里面,搜索功能修改逻辑。

jiaxiaoqiang há 5 meses atrás
pai
commit
69e2c63df9

+ 1 - 1
public/version.json

@@ -1,3 +1,3 @@
 {
-  "version": "3.9"
+  "version": "4.0"
 }

+ 4 - 1
src/api/craft/process/index.ts

@@ -1,10 +1,13 @@
 import request from "@/utils/request";
 
 // 返回一工段为
-export function processTreeList() {
+export function processTreeList(operationType: string) {
   return request({
     url: "/api/v1/op/baseOperation/treeList",
     method: "post",
+    data: {
+      operationType: operationType,
+    },
   });
 }
 

+ 26 - 16
src/views/base/craftManagement/route/bindProcess.vue

@@ -14,6 +14,7 @@
             v-model="list1SearchGroupDictKey"
             placeholder="搜索工序分组"
             clearable
+            filterable
           >
             <el-option
               v-for="dict in dictsArray"
@@ -337,11 +338,11 @@ const list1SearchStr = ref("");
 const list1SearchGroupDictKey = ref("");
 const showList = computed(() => {
   let array = _.cloneDeep(list1.value);
-  if (list1SearchGroupDictKey.value) {
-    array = array.filter((item) => {
-      return item.workSection === list1SearchGroupDictKey.value;
-    });
-  }
+  // if (list1SearchGroupDictKey.value) {
+  //   array = array.filter((item) => {
+  //     return item.workSection === list1SearchGroupDictKey.value;
+  //   });
+  // }
 
   array.forEach((item) => {
     item.baseOperationList = item.baseOperationList.filter((op) => {
@@ -419,7 +420,7 @@ const cancelInfo = () => {
   });
 };
 const loadTreeData = () => {
-  processTreeList().then((res) => {
+  processTreeList(list1SearchGroupDictKey.value).then((res) => {
     list1.value = res.data ?? [];
     filterDicts();
   });
@@ -429,17 +430,19 @@ const loadTreeData = () => {
 const dictsArray = ref([]);
 // 从dicts?.workshop_section筛选出list1中返回的字典值,用于最上方的选择框
 const filterDicts = () => {
-  const workSectionArray = list1.value.map((item) => {
-    return item.workSection;
-  });
+  dictsArray.value = dicts?.process_type ?? [];
 
-  const arr = [];
-  dicts?.workshop_section?.forEach((item) => {
-    if (workSectionArray.includes(item?.dictValue)) {
-      arr.push(_.cloneDeep(item));
-    }
-  });
-  dictsArray.value = arr;
+  // const workSectionArray = list1.value.map((item) => {
+  //   return item.workSection;
+  // });
+  //
+  // const arr = [];
+  // dicts?.workshop_section?.forEach((item) => {
+  //   if (workSectionArray.includes(item?.dictValue)) {
+  //     arr.push(_.cloneDeep(item));
+  //   }
+  // });
+  // dictsArray.value = arr;
 };
 
 const cancelStatus = ref(true);
@@ -502,6 +505,13 @@ watch(
     });
   }
 );
+
+watch(
+  () => list1SearchGroupDictKey.value,
+  () => {
+    loadTreeData();
+  }
+);
 </script>
 
 <style lang="scss" scoped>