feat(ai): 添加产品分类筛选功能到产品问答列表
- 在后端查询中添加产品分类条件过滤
- 在前端页面添加产品分类筛选下拉组件
- 集成 xmSelect 组件实现树形分类选择
- 添加分类数据获取和渲染逻辑
- 实现重置按钮清空分类选择功能
- 更新表格查询参数以包含分类筛选条件
- 按创建时间倒序排列结果
| | |
| | | if (StrUtil.isNotEmpty(dto.getCompanyId())){ |
| | | query.eq(AiProductQuestion::getCompanyId, dto.getCompanyId()); |
| | | } |
| | | if (StrUtil.isNotEmpty(dto.getProductCategoryId())){ |
| | | query.eq(AiProductQuestion::getProductCategoryId, dto.getProductCategoryId()); |
| | | } |
| | | query.ne(AiProductQuestion::getState, 2); |
| | | query.orderByDesc(AiProductQuestion::getCreatedTime); |
| | | Page<AiProductQuestion> pages = aiProductQuestionMapper.selectPage(page, query); |
| | | return pages; |
| | | } |
| | |
| | | <form class="layui-form layui-table-form" lay-filter="productQuestion-table-form"> |
| | | <div class="layui-row"> |
| | | <div class="layui-col-md10"> |
| | | <div class="layui-form-item"> |
| | | <div class="layui-row layui-col-space6 layui-form-item"> |
| | | <div class="layui-col-lg3"> |
| | | <label class="layui-form-label">产品分类:</label> |
| | | <div class="layui-input-block"> |
| | | <div id="product-qutestion-category-query"></div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-md2 layui-col-sm12 layui-col-xs12 table-action-area"> |
| | |
| | | <!-- 表格操作栏 end --> |
| | | <script data-th-inline="none" type="text/javascript"> |
| | | // 引入组件并初始化 |
| | | layui.use([ 'jquery', 'form', 'table', 'febs'], function () { |
| | | layui.use([ 'jquery', 'form', 'table', 'febs', 'xmSelect'], function () { |
| | | var $ = layui.jquery, |
| | | febs = layui.febs, |
| | | form = layui.form, |
| | |
| | | tableIns; |
| | | |
| | | form.render(); |
| | | |
| | | var categoryQuestion = xmSelect.render({ |
| | | el: '#product-qutestion-category-query', |
| | | language: 'zn', |
| | | prop : { |
| | | value : 'id', |
| | | children : 'child' |
| | | }, |
| | | iconfont: { |
| | | parent: 'hidden', |
| | | }, |
| | | tips: '请选择', |
| | | filterable: true, |
| | | radio: true, |
| | | clickClose: true, |
| | | tree: { |
| | | show: true, |
| | | //非严格模式 |
| | | strict: false, |
| | | }, |
| | | data: [] |
| | | }) |
| | | |
| | | febs.get(ctx + 'admin/productCategory/categoryTree', null, function(res) { |
| | | categoryQuestion.update({ |
| | | data : res.data, |
| | | autoRow: true, |
| | | }); |
| | | }) |
| | | |
| | | // 表格初始化 |
| | | initProductQuestionTable(); |
| | |
| | | |
| | | // 刷新按钮 |
| | | $reset.on('click', function () { |
| | | |
| | | var categoryList = []; |
| | | categoryQuestion.setValue(categoryList); |
| | | $searchForm[0].reset(); |
| | | sortObject.type = 'null'; |
| | | tableIns.reload({where: getQueryParams(), page: {curr: 1}, initSort: sortObject}); |
| | | tableIns.reload({where: null, page: {curr: 1}, initSort: sortObject}); |
| | | }); |
| | | // 获取查询参数 |
| | | function getQueryParams() { |
| | | return { |
| | | productCategoryId: categoryQuestion.getValue('valueStr'), |
| | | }; |
| | | } |
| | | |