瀏覽代碼

Merge branch 'dev' into dev_zyh

Jack Zhou 3 月之前
父節點
當前提交
bb5dd8a16d

二進制
dist.rar


+ 12 - 22
src/views/DestinationDelivery/src/components/ConfiguRations/src/components/CreateNewRule.vue

@@ -67,7 +67,6 @@ const InitRuleData = () => {
         countryCheckedList.value = returnData.station
         CountryCheckboxList.value = returnData.CountryCheckedList
         recommendata.value = returnData.RcommendDeliveryDate
-        getKLNList()
       }
     })
   }
@@ -135,7 +134,6 @@ const handleClickSelectCountry = (val:any) =>{
 // select station list
 const handleChangeStation = (val:any) =>{
   countryCheckedList.value = val
-  getKLNList()
 }
 
 // select booking window
@@ -158,23 +156,6 @@ const checkRecommend = (checked: any, airlist: any, sealist: any, radio: number)
   recommendRadio.value = radio
 }
 
-// 获取KLN列表
-const getKLNList = (): Promise<KLNItem[]> => {
-  return new Promise((resolve) => {
-    $api.getKLNEmployeeList({ 
-      term: '',
-      station: countryCheckedList.value
-    })
-      .then((res: any) => {
-        if (res.code === 200) {
-          KLNLists.value = res.data
-        } else {
-          resolve([]); // 失败返回空数组
-        }
-      })
-      .catch(() => resolve([])); // 异常兜底
-  });
-};
 // 自动查询KLN
 const loading = ref(false)
 const options = ref<KLNItem[]>([])
@@ -182,10 +163,19 @@ const querySearchAsync = (query: string) => {
   if (query) {
     loading.value = true
     setTimeout(() => {
-      loading.value = false
-      options.value = KLNLists.value.filter((item) => {
-        return item.label.toLowerCase().includes(query.toLowerCase())
+      $api.getKLNEmployeeList({ 
+        term: query,
+        station: countryCheckedList.value
       })
+        .then((res: any) => {
+          if (res.code === 200) {
+            loading.value = false
+            KLNLists.value = res.data
+            options.value = res.data.filter((item) => {
+              return item.label.toLowerCase().includes(query.toLowerCase())
+            })
+          }
+        })
     }, 1000)
   } else {
     options.value = []

+ 17 - 90
src/views/DestinationDelivery/src/components/ConfiguRations/src/components/RecommendDate.vue

@@ -85,19 +85,19 @@ const recommendata = ref(props.recommendata)
 const initRecommendData = () => {
   if(recommendata.value) {
     Recommendradio.value = recommendata.value.Recommendradio
-  if(Recommendradio.value == 2) {
-    isRecommendETA.value = true
-    RecommendCheckedList.value = recommendata.value.RecommendCheckedList
-    if(RecommendCheckedList.value.includes('Air')) {
-      isAir.value = true
+    if(Recommendradio.value == 2) {
+      isRecommendETA.value = true
+      RecommendCheckedList.value = recommendata.value.RecommendCheckedList
+      if(RecommendCheckedList.value.includes('Air')) {
+        isAir.value = true
+      }
+      if(RecommendCheckedList.value.includes('Sea')) {
+        isSea.value = true
+      }
+      AirContentList.value = recommendata.value.RecommendCheckedAirList
+      SeaContentList.value = recommendata.value.RecommendCheckedSeaList
     }
-    if(RecommendCheckedList.value.includes('Sea')) {
-      isSea.value = true
     }
-    AirContentList.value = recommendata.value.RecommendCheckedAirList
-    SeaContentList.value = recommendata.value.RecommendCheckedSeaList
-  } 
-  }
 }
 
 watch(() => props.recommendata, (val) => { 
@@ -119,7 +119,7 @@ function createRuleItem(type: 'Air' | 'Sea', ruleType: string): RuleItem {
       ...baseItem,
       ports: ruleType === '*Default Rule' ? ['ALL'] : [],
       mode_type: 'air',
-      PortList: JSON.parse(JSON.stringify(AirPorList.value))
+      // PortList: JSON.parse(JSON.stringify(AirPorList.value))
     }
   }
   return {
@@ -127,8 +127,8 @@ function createRuleItem(type: 'Air' | 'Sea', ruleType: string): RuleItem {
     ports: ruleType === '*Default Rule' ? ['ALL'] : [],
     carrier: ruleType === '*Default Rule' ? ['ALL'] : [],
     mode_type: 'sea',
-    PortList: JSON.parse(JSON.stringify(SeaPortList.value)),
-    CarrierList: JSON.parse(JSON.stringify(SeaCarrierList.value))
+    // PortList: JSON.parse(JSON.stringify(SeaPortList.value)),
+    // CarrierList: JSON.parse(JSON.stringify(SeaCarrierList.value))
   }
 }
 
@@ -375,76 +375,6 @@ const changeRuleType = (val: string, index: number, list: RuleItem[]) => {
   item.rule_type = val
   updatePriorities()
 }
-
-// 获取Air Port/Port/Carrier的值
-const AirPorList = ref([])
-const SeaPortList = ref([])
-const SeaCarrierList = ref([])
-const getPortList = (type: any) => {
-  $api.getPortList({ 
-    term: '',
-    mode: type
-  }).then((res: any) => {
-    if (res.code === 200) {
-      if(type === 'air') {
-        AirPorList.value = res.data
-        // 更新现有行的列表
-        AirContentList.value.forEach(item => {
-          item.PortList = JSON.parse(JSON.stringify(res.data))
-          setTimeout(() => {
-            if(AirPortRef.value) {
-              AirPortRef.value.forEach(item1 => { 
-                item1.initGetPortsList(item.PortList)
-              })
-            }
-          }, 1000);
-        })
-      }
-      if(type === 'sea') {
-        SeaPortList.value = res.data
-        // 更新现有行的列表
-        SeaContentList.value.forEach(item => {
-          item.PortList = JSON.parse(JSON.stringify(res.data))
-          setTimeout(() => {
-            if(SeaPortRef.value) {
-              SeaPortRef.value.forEach(item1 => { 
-                item1.initGetPortsList(item.PortList)
-              })
-            }
-          }, 1000);
-        })
-      }
-    }
-  })
-}
-
-// 获取Carrier列表
-const getCarrierList = () => {
-  $api.getCarrierList({ 
-    term: '',
-  }).then((res: any) => {
-    if (res.code === 200) {
-      SeaCarrierList.value = res.data
-      // 更新现有行的列表
-      SeaContentList.value.forEach(item => {
-        item.CarrierList = JSON.parse(JSON.stringify(res.data))
-        setTimeout(() => {
-          if(SeaCarrierRef.value) {
-            SeaCarrierRef.value.forEach(item1 => { 
-              item1.initGetPortsList(item.CarrierList)
-            })
-          }
-        }, 1000);
-      })
-    }
-  })
-}
-
-onMounted(() => {
-  getPortList('air')
-  getPortList('sea')
-  getCarrierList()
-})
 </script>
 
 <template>
@@ -498,8 +428,7 @@ onMounted(() => {
                       :SelectIndex="index"
                       :SelectedValue="item.ports"
                       :typeisDisabled="item.rule_type"
-                      :PortList="item.PortList"
-                      SelectType="Air"
+                      SelectType="air"
                       @changeSelectedValue="val => changeSelectedValue(val, index, 'ports', AirContentList)"
                     />
                   </div>
@@ -574,8 +503,7 @@ onMounted(() => {
                       :SelectIndex="index"
                       :SelectedValue="item.ports"
                       :typeisDisabled="item.rule_type"
-                      :PortList="item.PortList"
-                      SelectType="Sea"
+                      SelectType="sea"
                       @changeSelectedValue="val => changeSelectedValue(val, index, 'ports', SeaContentList)"
                     />
                   </div>
@@ -585,8 +513,7 @@ onMounted(() => {
                       :SelectIndex="index"
                       :SelectedValue="item.carrier"
                       :typeisDisabled="item.rule_type"
-                      :PortList="item.CarrierList"
-                      SelectType="Sea"
+                      SelectType="carrier"
                       @changeSelectedValue="val => changeSelectedValue(val, index, 'carrier', SeaContentList)"
                     />
                   </div>

+ 61 - 9
src/views/DestinationDelivery/src/components/ConfiguRations/src/components/SelectValue.vue

@@ -30,6 +30,7 @@ const props = defineProps({
   }
 })
 const checkAll = ref(false)
+const loading = ref(false)
 const value = ref<string[]>(props.SelectedValue)
 const SelectNumber = ref(props.SelectIndex)
 const typeisDisabled = ref(props.typeisDisabled)
@@ -52,12 +53,63 @@ watch(
   }
 , { immediate: true, deep: true })
 
-const initGetPortsList = (val: any) => {
-  PortList.value = val.map(item => ({
-    ...item,
-    checked: checkAll.value? true : value.value.includes(item.value)
-  }));
+const list = ref<PortOption[]>([])
+const remoteMethod = (query: string) => {
+  if (query) {
+    loading.value = true
+    setTimeout(() => {
+      if(props.SelectType == 'carrier') {
+        $api
+        .getCarrierList({
+          term: query
+        })
+        .then((res: any) => {
+          loading.value = false
+          if (res.code == 200) {
+            if(value.value[0] == 'ALL') {
+              list.value = res.data.map((item: any) => {
+                return { value: item.value, label: item.label, checked: true }
+              })
+            } else {
+              list.value = res.data.map((item: any) => {
+                return { value: item.value, label: item.label, checked: value.value?.includes(item.value) }
+              })
+            }
+            PortList.value = list.value.filter((item) => {
+              return item.label.toLowerCase().includes(query.toLowerCase())
+            })
+          }
+        })
+      } else {
+        $api
+        .getPortList({
+          term: query,
+          mode: props.SelectType
+        })
+        .then((res: any) => {
+          loading.value = false
+          if (res.code == 200) {
+            if(value.value[0] == 'ALL') {
+              list.value = res.data.map((item: any) => {
+                return { value: item.value, label: item.label, checked: true }
+              })
+            } else {
+              list.value = res.data.map((item: any) => {
+                return { value: item.value, label: item.label, checked: value.value?.includes(item.value) }
+              })
+            }
+            PortList.value = list.value.filter((item) => {
+              return item.label.toLowerCase().includes(query.toLowerCase())
+            })
+          }
+        })
+      }
+    }, 200)
+  } else {
+    PortList.value = []
+  }
 }
+
 const emits = defineEmits(['changeSelectedValue', 'handelremovetag'])
 
 watch(value, (val) => {
@@ -113,7 +165,7 @@ const handelRemoveTag = (tag) => {
 }
 
 const displayNumber = computed(() => {
-  return props.SelectType === 'Air' ? 6 : 3
+  return props.SelectType === 'air' ? 6 : 3
 })
 
 const visibleTags = computed(() => { 
@@ -123,9 +175,6 @@ const hiddenTagsCount = computed(() => {
   return Math.max(value.value.length - displayNumber.value, 0);
 })
 
-defineExpose({
-  initGetPortsList
-})
 </script>
 <template>
   <div style="width: 100%;">
@@ -133,10 +182,13 @@ defineExpose({
       v-model="value"
       multiple
       filterable
+      remote
       :disabled="typeisDisabled  == '*Default Rule'"
       placeholder="Select"
+      :remote-method="remoteMethod"
       popper-class="custom-sheader-select"
       @change="handelchangeSelect"
+      :loading="loading"
     >
       <template #header>
         <a-checkbox v-model:checked="checkAll" @change="handleCheckAll">ALL</a-checkbox>