Bläddra i källkod

团组信息加城市逻辑

liuhj 2 veckor sedan
förälder
incheckning
d76cfa5e26
2 ändrade filer med 46 tillägg och 1 borttagningar
  1. 4 1
      src/components/OP/EntryDetails.vue
  2. 42 0
      src/components/OP/Groupedit.vue

+ 4 - 1
src/components/OP/EntryDetails.vue

@@ -414,7 +414,7 @@
                                     <el-select size="mini" @change="changeSelect(scope.row, $event, scope.$index)"
                                         v-model="scope.row.nationalTravelFeeId" filterable placeholder="请选择">
                                         <el-option v-for="item in placeinif" :key="item.id" :label="item.cityname"
-                                            :value="item.id">
+                                            :value="item.provinceId">
                                             <span style="float: left">{{ item.cityname }}</span>
                                             <!-- <span style="float: right; color: #8492a6; font-size: 13px">{{item.city}}</span> -->
                                         </el-option>
@@ -1193,12 +1193,15 @@ export default {
                 }
             }).then(function (res) {
                 let placeinifarr = [];
+                that.placeinif=[];
                 if (res.data.code == 200) {
                     for (let i = 0; i < res.data.data.length; i++) {
                         res.data.data[i]['cityname'] = res.data.data[i].country + '-' + res.data.data[i].city;
                         placeinifarr.push(res.data.data[i]);
                     }
                     that.placeinif = placeinifarr;
+                    console.log(that.placeinif);
+                    
                 }
             })
         },

+ 42 - 0
src/components/OP/Groupedit.vue

@@ -355,6 +355,8 @@ export default {
             rollcallarr:[],
             nongroupty:true,
             depname:'',
+            //xiao nao fa yu bu jian quan de xu qiu
+            companyName:'',
         };
     },
     methods: {
@@ -412,6 +414,42 @@ export default {
             // this.$router.back(-1)
             this.$router.go(-1);
         },
+        //匹配
+        filteredItems() {
+            if (this.companyName=='') return this.cityData;
+
+            const searchChars = this.companyName.toLowerCase();
+
+            return this.cityData.filter(item => {
+                // 将对象的所有字符串属性拼接起来
+                const searchContent = item.name.toLowerCase();
+                // 检查搜索字符串中的每个字符是否出现在对象内容中
+                for (let i = 0; i < searchChars.length; i++) {
+                    if (searchContent.includes(searchChars[i])) {
+                        return true;
+                    }
+                }
+                return false;
+            }).map(item => {
+                // 添加匹配字符信息
+                const matchedChars = [];
+                const searchContent = Object.values(item)
+                    .filter(value => typeof value === 'string')
+                    .join(' ')
+                    .toLowerCase();
+
+                for (let i = 0; i < searchChars.length; i++) {
+                    if (searchContent.includes(searchChars[i])) {
+                        matchedChars.push(searchChars[i]);
+                    }
+                }
+
+                return {
+                    ...item,
+                    matchedChars: [...new Set(matchedChars)] // 去重
+                };
+            });
+        },
         //获取下拉列表
         getdown() {
             var url = "/api/Groups/GroupEditBasicSource"
@@ -443,6 +481,9 @@ export default {
                     that.gradearr = res.data.data.teamLevData;
                     that.OPtype = res.data.data.teamTypeData;
                     that.cityData = res.data.data.cityData;
+                    that.ruleForm.cityId=that.filteredItems()[0].id;
+                    console.log(that.filteredItems());
+                    
                 }
             })
             var url = "/api/System/QuerySetData"
@@ -792,6 +833,7 @@ export default {
         this.token = JSON.parse(localStorage.getItem('userinif')).token;
         this.userid = JSON.parse(localStorage.getItem('userinif')).userInfo.userId;
         this.depname = JSON.parse(localStorage.getItem('userinif')).userInfo.depName;
+        this.companyName = JSON.parse(localStorage.getItem('userinif')).userInfo.companyName;
         setTimeout(() => {
             this.PostTourClientListByDiId();
         }, 500);