当前位置: 首页 > wzjs >正文

网站建设与应用岗位阜阳城乡建设局网站

网站建设与应用岗位,阜阳城乡建设局网站,网易网页游戏,长春市工程咨询有限公司详细前端代码写于上一篇:输入搜索、分组展示选项、下拉选取,el-select 实现:即输入关键字检索,返回分组选项,选取跳转到相应内容页 —— VUE项目-全局模糊检索 【效果图】:分组展示选项 >【去界面操作体…

 详细前端代码写于上一篇:输入搜索、分组展示选项、下拉选取,el-select 实现:即输入关键字检索,返回分组选项,选取跳转到相应内容页 —— VUE项目-全局模糊检索

【效果图】:分组展示选项 =>【去界面操作体验】

【mybatis】:多数据表抓取数据

<select id="findNews" resultType="com.bootdo.search.vo.SearchDetail">SELECT      n.cid           AS srcId,pt.id           AS typeId,pt.type_key     AS typeKey,pt.page_type    AS pageType,pt.page_name    AS srcTypeName,n.title         AS srcName,n.summary       AS alias,pt.page_path    AS srcPathFROM a_news nLEFT JOIN a_product_type pt ON n.type_id = pt.idWHERE n.sys_id = #{sysId} AND n.is_enabled = 0 AND (n.title LIKE #{query} OR n.summary LIKE #{query} OR n.content LIKE #{query})LIMIT 20</select><select id="findProducts" resultType="com.bootdo.search.vo.SearchDetail">SELECT      pt.id            AS srcId,pt.page_type    AS pageType,pt.page_name    AS srcTypeName,pt.type_name     AS srcName,pt.type_key     AS alias,pt.page_path    AS srcPathFROM a_product_type ptWHERE  pt.sys_id = #{sysId} AND pt.is_deleted = 0 AND pt.type_name LIKE #{query}LIMIT 20</select><select id="findItemInfos" resultType="com.bootdo.search.vo.SearchDetail">SELECT      n.cid           AS srcId,pt.id           AS typeId,pt.type_key     AS typeKey,pt.page_type    AS pageType,pt.page_name    AS srcTypeName,pt.type_name    AS srcName,pt.type_name    AS alias,pt.page_path    AS srcPathFROM a_item_info nLEFT JOIN a_product_type pt ON n.type_id = pt.idWHERE n.sys_id = #{sysId} AND n.is_enabled = 0 AND n.content LIKE #{query}LIMIT 20</select>

【java】:各数据源进一步整理、合并、分组

    public List<SearchVO> search(Map<String, Object> params){Map<String, SearchDetail> map = new HashMap<>();List<SearchDetail> products = searchDao.findProducts(params);List<SearchDetail> itemInfos = searchDao.findItemInfos(params);List<SearchDetail> news = searchDao.findNews(params);for(SearchDetail sd : products){String srcPath = sd.getSrcPath()+"?typeKey="+sd.getAlias();sd.setSrcPath(srcPath);map.put(srcPath, sd);}for(SearchDetail sd : itemInfos){this.changePath(map, sd);}for(SearchDetail sd : news){this.changePath(map, sd);}return groupSearchDetailsByTypeName(map.values());}private void changePath(Map<String, SearchDetail> map, SearchDetail sd){String srcPath = sd.getSrcPath();if(StringUtils.equals(srcPath, "/n")){srcPath = srcPath+"/nId?showDetailNewId="+sd.getSrcId()+"&menuSearch=true";sd.setSrcPath(srcPath);}if(StringUtils.equals(srcPath, "/p")){srcPath = srcPath+"/pId?showDetailNewId="+sd.getSrcId()+"&menuSearch=true&typeId="+sd.getTypeId()+"&typeKey="+sd.getTypeKey();sd.setSrcPath(srcPath);}map.put(srcPath, sd);}private List<SearchVO> groupSearchDetailsByTypeName(Collection<SearchDetail> sds) {// 使用 Collectors.groupingBy 按 srcTypeName(即 label)分组Map<Integer, List<SearchDetail>> groupedByTypeName = sds.stream().collect(Collectors.groupingBy(SearchDetail::getPageType));// 将分组后的数据转换为 List<SearchVO>List<SearchVO> searchVOList = new ArrayList<>();for (Map.Entry<Integer, List<SearchDetail>> entry : groupedByTypeName.entrySet()) {SearchVO searchVO = new SearchVO();List<SearchDetail> value = entry.getValue();searchVO.setLabel(value.get(0).getSrcTypeName());searchVO.setOptions(value);searchVOList.add(searchVO);}return searchVOList;}

vue、js

<el-row :gutter="20" style="display: flex;  border-radius: 5px;" ><el-col style="margin-bottom: 7px;"><lilo-group-select @change="groupSelectChange" :multiple="false" :likeQuery="true" :searchApi="'/api/list/search'" clearable placeholder="请输入快速搜索" ></lilo-group-select></el-col>
</el-row>groupSelectChange(option) {console.log("下拉选项选中:"+JSON.stringify(option));if(option==''|| option.srcPath=='')return;// this.$router.push(option.srcPath);this.$router.push(option.srcPath).catch(err => {if (err.name !== 'NavigationDuplicated') {// 处理其他可能的错误console.error(err);}// 对于 NavigationDuplicated 错误,可以选择不做任何处理});
},

详细前端代码写于上一篇:输入搜索、分组展示选项、下拉选取,el-select 实现:即输入关键字检索,返回分组选项,选取跳转到相应内容页 —— VUE项目-全局模糊检索

http://www.dtcms.com/wzjs/817677.html

相关文章:

  • 做粉丝网站so导航 抖音
  • 镇江市住房城乡建设局网站网站建设公司咨询电话
  • 中山网站建设收费标准人力管理系统
  • 中国水电建设集团港航建设有限公司网站上海做无创DNA医院网站
  • 装修网站排名前十名广州天河
  • 东莞网站推广软件怎么在网站视频做字幕
  • wordpress文章自动分页长沙seo招聘
  • 响应式网站的服务兰州装修公司口碑排名推荐
  • 网站开发未来建设网站需要收费吗
  • wordpress网站使用教程微信小程序直播开通条件
  • 坪山公司网站建设wordpress分类目录链接
  • 网站建设会计分录怎么做做漫画在线观看网站
  • 中国建筑考试网官网首页安徽网站建设SEO优化制作设计公司
  • 江苏网站建设包括哪些免费 wordpress
  • 竞价网站策划设计官网页面多少钱
  • 郑州网站开发公司哪家好wordpress修改logo地址
  • 西宁设计网站建设温州网站建设专家
  • 如何申请一个免费的网站空间做会计公司网站的目录
  • 电影网站建设需求分析珠海手机网站建设价格
  • 高端网站建站网络科技公司主要做什么
  • 个人工商注册查询网站子公司怎么注册
  • 网站首页如何设计wordpress登录界面能改吗
  • 贵州省建设厅网站官网wordpress+主题+引入js
  • 国外域名 网站备案物流网站和数据库建设
  • 百度快照 网站描述 更新全网营销代运营公司
  • 网站做编辑器邮箱的官方网站注册
  • 做网站那种布局好互联网保险的典型产品
  • 做消费金融网站价格有趣的网站官网
  • 集团公司做网站的好处有什么wordpress安装选择协议怎么写
  • 养老网站备案必须做前置审批吗网站建设工作领导小组