Răsfoiți Sursa

feat:添加警告样式

AmandaG 1 an în urmă
părinte
comite
ea3268f0d8

+ 38 - 19
src/components/MoreFilters/src/MoreFilters.vue

@@ -457,31 +457,50 @@ const changeAutoSelectVal = (val: any, value: any) => {
 }
 // 点击search
 const emit = defineEmits(['MoreFiltersSearch', 'clearMoreFiltersTags'])
+const errorList: any = ref({
+  partyorigin: false,
+  partydestination: false,
+  partysales: false
+})
 const SearchMore = () => {
-  // 判断是否有验证样式
-  const input_change = document.getElementsByClassName('input_change')
+  console.log(AddDateType.value)
   if (AddDateType.value.length) {
-    AddDateType.value.forEach((item: any, index: any) => {
+    AddDateType.value.forEach((item: any) => {
       if (item.partyType != '' && item.partyname.length == 0) {
-        item.isshowVerfication = true
-        verification.value = 'Please input Party Details'
-        input_change[index].classList.add('AlertInput')
-      } else {
-        item.isshowVerfication = false
-        input_change[index].classList.remove('AlertInput')
+        if (item.partyType == 'Origin Agent') {
+          errorList.value.partyorigin = true
+        } else if (item.partyType == 'Destination Agent') {
+          errorList.value.partydestination = true
+        } else {
+          errorList.value.partysales = true
+        }
       }
     })
-    const AlertInput = document.getElementsByClassName('AlertInput')
-    if (AlertInput.length == 0) {
-      // 传数据给父组件
-      emit('MoreFiltersSearch', MoreFiltersObj, MoreFiltersObj2)
-      drawer.value = false
-    }
-  } else {
-    // 传数据给父组件
-    emit('MoreFiltersSearch', MoreFiltersObj, MoreFiltersObj2)
-    drawer.value = false
   }
+  // 判断是否有验证样式
+  // const input_change = document.getElementsByClassName('input_change')
+  // if (AddDateType.value.length) {
+  //   AddDateType.value.forEach((item: any, index: any) => {
+  //     if (item.partyType != '' && item.partyname.length == 0) {
+  //       item.isshowVerfication = true
+  //       verification.value = 'Please input Party Details'
+  //       input_change[index].classList.add('AlertInput')
+  //     } else {
+  //       item.isshowVerfication = false
+  //       input_change[index].classList.remove('AlertInput')
+  //     }
+  //   })
+  //   const AlertInput = document.getElementsByClassName('AlertInput')
+  //   if (AlertInput.length == 0) {
+  //     // 传数据给父组件
+  //     emit('MoreFiltersSearch', MoreFiltersObj, MoreFiltersObj2)
+  //     drawer.value = false
+  //   }
+  // } else {
+  //   // 传数据给父组件
+  //   emit('MoreFiltersSearch', MoreFiltersObj, MoreFiltersObj2)
+  //   drawer.value = false
+  // }
 }
 // 清除
 const clearrest = () => {

+ 13 - 6
src/components/selectAutoSelect/src/selectAutoSelect.vue

@@ -1,7 +1,6 @@
 <script setup lang="ts">
 import { ref, watch } from 'vue'
 import IconDropDown from '@/components/IconDropDown'
-import VerrifyInformation from '@/components/VerrifyInformation'
 interface TypeItem {
   partyType: ''
   partyname: []
@@ -19,18 +18,20 @@ interface Props {
   AddDateType: TypeItem[]
   ASPlaceholder: string
   DateTypeoptions: dateoptions[]
-  Verification: string
   selectedPartyTypeoptions: Array<string>
+  ASErrorList: Object
 }
 interface optionsItem {
   value: string
   label: string
 }
+
 const list = ref<ListItem[]>([])
 const options = ref<ListItem[]>([])
 const loading = ref(false)
 const props = withDefaults(defineProps<Props>(), {})
 const AddType = ref(props.AddDateType)
+const errorList = ref(props.ASErrorList)
 const value = ref()
 const dataTypeoptions = ref<optionsItem[]>([])
 const typeSelectIndex = ref(-1)
@@ -198,12 +199,17 @@ const typeSelectClick = (index: any, val: any) => {
     </div>
     <div style="margin-top: 16px">
       <div class="ETD_title">Party Details</div>
+      {{ AddType[index].partyname }}
+      {{ AddType[index].partyType }}
       <el-select
         v-model="AddType[index].partyname"
         multiple
         filterable
         remote
         class="input_change"
+        :class="{
+          is_error: AddType[index].partyType != '' && AddType[index].partyname.length == 0
+        }"
         :reserve-keyword="false"
         :placeholder="props.ASPlaceholder"
         collapse-tags
@@ -226,10 +232,6 @@ const typeSelectClick = (index: any, val: any) => {
           <div class="label">{{ item.value }}</div>
         </el-option>
       </el-select>
-      <VerrifyInformation
-        :isshowVerfication="AddDateType[index].isshowVerfication"
-        :verification="props.Verification"
-      ></VerrifyInformation>
     </div>
   </div>
 </template>
@@ -285,4 +287,9 @@ const typeSelectClick = (index: any, val: any) => {
 .AlertInput :deep(.el-select__wrapper) {
   box-shadow: 0 0 0 0.5px var(--color-danger);
 }
+.is-error {
+  :deep(.el-input__wrapper) {
+    box-shadow: 0 0 0 1px var(--color-danger) inset;
+  }
+}
 </style>

+ 1 - 1
src/views/Tracking/src/TrackingView.vue

@@ -239,7 +239,7 @@ const TagsList = ref<ListItem[]>([])
 const filterTag = ref(['All'])
 onMounted(() => {
   if (
-    sessionStorage.getItem('clickParams') != null ||
+    sessionStorage.getItem('clickParams') != null &&
     sessionStorage.getItem('clickParams') != ''
   ) {
     const data = JSON.parse(sessionStorage.getItem('tagsList') as string) || {}