Merge remote-tracking branch 'origin/dev_third_stage' into dev_third_stage
This commit is contained in:
+2
@@ -8,6 +8,8 @@ package com.jero.modules.document.enums;
|
|||||||
public enum SearchEnum {
|
public enum SearchEnum {
|
||||||
INDEX_NAME_DOCUMENT("文档库索引名称","documentLibrary"),
|
INDEX_NAME_DOCUMENT("文档库索引名称","documentLibrary"),
|
||||||
TYPE_NAME_DOCUMENT("文档库类型","document"),
|
TYPE_NAME_DOCUMENT("文档库类型","document"),
|
||||||
|
INDEX_NAME_LAWS_MONTHLY_REPORT("法规月报索引名称","lawsMonthlyReportManage"),
|
||||||
|
TYPE_NAME_LAWS_MONTHLY_REPORT("法规月报类型名称","lawsMonthlyReport"),
|
||||||
FULL_TEXT_SEARCH("全部中文","fulltextsearchcn"),
|
FULL_TEXT_SEARCH("全部中文","fulltextsearchcn"),
|
||||||
FULL_TEXT_SEARCH_CN("全部中文","fulltextsearchcn"),
|
FULL_TEXT_SEARCH_CN("全部中文","fulltextsearchcn"),
|
||||||
FULL_TEXT_SEARCH_EN("全部英文","fulltextsearchen");
|
FULL_TEXT_SEARCH_EN("全部英文","fulltextsearchen");
|
||||||
|
|||||||
+149
-2
@@ -1,20 +1,32 @@
|
|||||||
package com.jero.modules.report.service.impl;
|
package com.jero.modules.report.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.jero.common.constant.enums.CutEnum;
|
||||||
|
import com.jero.common.es.JeroElasticsearchTemplate;
|
||||||
import com.jero.common.system.vo.LoginUser;
|
import com.jero.common.system.vo.LoginUser;
|
||||||
|
import com.jero.modules.document.enums.SearchEnum;
|
||||||
|
import com.jero.modules.document.utils.ReadPdfUtil;
|
||||||
|
import com.jero.modules.document.utils.ReadWordUtil;
|
||||||
import com.jero.modules.dummy.enums.InventoryStateEnum;
|
import com.jero.modules.dummy.enums.InventoryStateEnum;
|
||||||
|
import com.jero.modules.oss.entity.OSSFile;
|
||||||
|
import com.jero.modules.oss.service.IOSSFileService;
|
||||||
import com.jero.modules.report.entity.LawsMonthlyReportManageEO;
|
import com.jero.modules.report.entity.LawsMonthlyReportManageEO;
|
||||||
import com.jero.modules.report.mapper.LawsMonthlyReportManageEOMapper;
|
import com.jero.modules.report.mapper.LawsMonthlyReportManageEOMapper;
|
||||||
import com.jero.modules.report.service.ILawsMonthlyReportManageEOService;
|
import com.jero.modules.report.service.ILawsMonthlyReportManageEOService;
|
||||||
|
import com.jero.modules.system.service.ISysDictItemService;
|
||||||
|
import com.jero.modules.system.util.StringUtils;
|
||||||
import org.apache.shiro.SecurityUtils;
|
import org.apache.shiro.SecurityUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 法规月报管理
|
* @Description: 法规月报管理
|
||||||
@@ -25,6 +37,21 @@ import java.util.List;
|
|||||||
@Service
|
@Service
|
||||||
public class LawsMonthlyReportManageEOServiceImpl extends ServiceImpl<LawsMonthlyReportManageEOMapper, LawsMonthlyReportManageEO> implements ILawsMonthlyReportManageEOService {
|
public class LawsMonthlyReportManageEOServiceImpl extends ServiceImpl<LawsMonthlyReportManageEOMapper, LawsMonthlyReportManageEO> implements ILawsMonthlyReportManageEOService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysDictItemService sysDictItemService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private JeroElasticsearchTemplate jeroElasticsearchTemplate;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IOSSFileService iOSSFileService;
|
||||||
|
|
||||||
|
@Value(value = "${jero.path.upload}")
|
||||||
|
private String uploadpath;
|
||||||
|
|
||||||
|
public static final String SEARCH_FLAG = "魑";//标识(es数据带此标识的代表全文和段落的数据,不带此标识的代表列表数据)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存
|
* 保存
|
||||||
*
|
*
|
||||||
@@ -110,6 +137,126 @@ public class LawsMonthlyReportManageEOServiceImpl extends ServiceImpl<LawsMonthl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void issue(LawsMonthlyReportManageEO lawsMonthlyReportManageEO) {
|
public void issue(LawsMonthlyReportManageEO lawsMonthlyReportManageEO) {
|
||||||
|
String id = lawsMonthlyReportManageEO.getId();
|
||||||
|
String issueStatus = lawsMonthlyReportManageEO.getIssueStatus();
|
||||||
|
|
||||||
|
LawsMonthlyReportManageEO monthlyReportManageEO = getById(id);
|
||||||
|
|
||||||
|
Date issueTime = new Date();
|
||||||
|
lawsMonthlyReportManageEO.setUpdateTime(issueTime);
|
||||||
this.updateById(lawsMonthlyReportManageEO);
|
this.updateById(lawsMonthlyReportManageEO);
|
||||||
|
|
||||||
|
if ("1".equals(issueStatus)) { // 已发布---发布操作
|
||||||
|
// 添加月报到es
|
||||||
|
OSSFile ossFile = iOSSFileService.getById(monthlyReportManageEO.getFileId());
|
||||||
|
String fileText = "";
|
||||||
|
|
||||||
|
// 读取月报文件内容
|
||||||
|
if (ossFile.getFileName().endsWith(".doc")
|
||||||
|
|| ossFile.getFileName().endsWith(".docx")
|
||||||
|
|| ossFile.getFileName().endsWith(".DOC")
|
||||||
|
|| ossFile.getFileName().endsWith(".DOCX")) {
|
||||||
|
|
||||||
|
String wordContent = null;
|
||||||
|
try {
|
||||||
|
wordContent = ReadWordUtil.readWord(ossFile.getUrl(),uploadpath);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("文档库: 读取word内容失败");
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(wordContent)) {
|
||||||
|
fileText = wordContent;
|
||||||
|
}
|
||||||
|
} else if (ossFile.getFileName().endsWith(".pdf") || ossFile.getFileName().endsWith(".PDF")) {
|
||||||
|
String pdfContent = null;
|
||||||
|
try {
|
||||||
|
pdfContent = ReadPdfUtil.readPdf(ossFile.getUrl());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("文档库: 读取PDF文件内容失败");
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(pdfContent)) {
|
||||||
|
fileText = pdfContent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Map<String, Object> stringMapCn = new HashMap<>();
|
||||||
|
Map<String, Object> stringMapEn = new HashMap<>();
|
||||||
|
Map<String, Object> stringMapCnForSearch = new HashMap<>();
|
||||||
|
Map<String, Object> stringMapEnForSearch = new HashMap<>();
|
||||||
|
List<Map<String, Object>> mapListTempCn = new ArrayList<>();
|
||||||
|
List<Map<String, Object>> mapListTempEn = new ArrayList<>();
|
||||||
|
//文件相关封装中文的全文内容(es) 非搜索条件下的:flag---SEARCH_FLAG
|
||||||
|
putMap(id, "法规月报",
|
||||||
|
fileText, monthlyReportManageEO.getName(), fileText,
|
||||||
|
ossFile.getFileName(), ossFile.getId(), issueTime, CutEnum.CN.getValue(), stringMapCn, SEARCH_FLAG);
|
||||||
|
//文件相关封装英文的全文内容(es) 搜索条件下的: flag---null
|
||||||
|
putMap(id, "monthly report",
|
||||||
|
fileText, monthlyReportManageEO.getName(), fileText,
|
||||||
|
ossFile.getFileName(), ossFile.getId(), issueTime, CutEnum.EN.getValue(), stringMapEn, SEARCH_FLAG);
|
||||||
|
|
||||||
|
//文件相关封装中文的全文内容(es)
|
||||||
|
putMap(id + monthlyReportManageEO.getFileId(), "法规月报",
|
||||||
|
fileText, monthlyReportManageEO.getName(), fileText,
|
||||||
|
ossFile.getFileName(), ossFile.getId(), issueTime, CutEnum.CN.getValue(), stringMapCnForSearch, null);
|
||||||
|
//文件相关封装英文的全文内容(es)
|
||||||
|
putMap(id + monthlyReportManageEO.getFileId(), "monthly report",
|
||||||
|
fileText, monthlyReportManageEO.getName(), fileText,
|
||||||
|
ossFile.getFileName(), ossFile.getId(), issueTime, CutEnum.EN.getValue(), stringMapEnForSearch, null);
|
||||||
|
|
||||||
|
mapListTempCn.add(stringMapCn);
|
||||||
|
mapListTempCn.add(stringMapCnForSearch);
|
||||||
|
mapListTempEn.add(stringMapEn);
|
||||||
|
mapListTempEn.add(stringMapEnForSearch);
|
||||||
|
|
||||||
|
//添加es
|
||||||
|
JSONObject jsonObjectCn = JSON.parseObject(JSON.toJSONString(stringMapCn));
|
||||||
|
JSONObject jsonObjectEn = JSON.parseObject(JSON.toJSONString(stringMapEn));
|
||||||
|
JSONArray arrayCn = JSONArray.parseArray(JSON.toJSONString(mapListTempCn));
|
||||||
|
JSONArray arrayEn = JSONArray.parseArray(JSON.toJSONString(mapListTempEn));
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 法规月报
|
||||||
|
jeroElasticsearchTemplate.saveOrUpdate(SearchEnum.INDEX_NAME_LAWS_MONTHLY_REPORT.getValue(), SearchEnum.TYPE_NAME_LAWS_MONTHLY_REPORT.getValue(), id, jsonObjectCn);
|
||||||
|
//全部
|
||||||
|
jeroElasticsearchTemplate.saveBatch(SearchEnum.FULL_TEXT_SEARCH_CN.getValue(), SearchEnum.FULL_TEXT_SEARCH_CN.getValue(), arrayCn);
|
||||||
|
jeroElasticsearchTemplate.saveBatch(SearchEnum.FULL_TEXT_SEARCH_EN.getValue(), SearchEnum.FULL_TEXT_SEARCH_EN.getValue(), arrayEn);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("文档库添加es失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if ("2".equals(issueStatus)) { // 待发布---撤回操作
|
||||||
|
// 删除es中的月报
|
||||||
|
try {
|
||||||
|
jeroElasticsearchTemplate.delete(SearchEnum.INDEX_NAME_LAWS_MONTHLY_REPORT.getValue(), SearchEnum.TYPE_NAME_LAWS_MONTHLY_REPORT.getValue(), id);
|
||||||
|
//删除全部中文的
|
||||||
|
jeroElasticsearchTemplate.delete(SearchEnum.FULL_TEXT_SEARCH.getValue(), SearchEnum.FULL_TEXT_SEARCH.getValue(), id);
|
||||||
|
jeroElasticsearchTemplate.delete(SearchEnum.FULL_TEXT_SEARCH_CN.getValue(), SearchEnum.FULL_TEXT_SEARCH_CN.getValue(), id);
|
||||||
|
jeroElasticsearchTemplate.delete(SearchEnum.FULL_TEXT_SEARCH_CN.getValue(), SearchEnum.FULL_TEXT_SEARCH_CN.getValue(), id + monthlyReportManageEO.getFileId());
|
||||||
|
//删除全部英文的
|
||||||
|
jeroElasticsearchTemplate.delete(SearchEnum.FULL_TEXT_SEARCH_EN.getValue(), SearchEnum.FULL_TEXT_SEARCH_EN.getValue(), id);
|
||||||
|
jeroElasticsearchTemplate.delete(SearchEnum.FULL_TEXT_SEARCH_EN.getValue(), SearchEnum.FULL_TEXT_SEARCH_EN.getValue(), id + monthlyReportManageEO.getFileId());
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
log.error("文档库删除es失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void putMap(String id, String moduleType,
|
||||||
|
String content, String title , String fileText,
|
||||||
|
String fileName, String fileId, Date issueTime, String cut,
|
||||||
|
Map<String, Object> stringMap,
|
||||||
|
String flag){
|
||||||
|
stringMap.put("id", id);
|
||||||
|
stringMap.put("module_type", moduleType);
|
||||||
|
stringMap.put("content", content);
|
||||||
|
stringMap.put("title", title);
|
||||||
|
stringMap.put("file_text", fileText);
|
||||||
|
stringMap.put("file_name", fileName);
|
||||||
|
stringMap.put("file_id", fileId);
|
||||||
|
stringMap.put("issue_time", issueTime);
|
||||||
|
stringMap.put("cut",cut);
|
||||||
|
stringMap.put("flag",flag);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+38
@@ -0,0 +1,38 @@
|
|||||||
|
package com.jero.modules.searchcenter.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.jero.common.api.vo.Result;
|
||||||
|
import com.jero.modules.searchcenter.service.ILawsMonthlyReportSearchService;
|
||||||
|
import com.jero.modules.searchcenter.vo.SearchVO;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 搜索中心-法规月报 控制层
|
||||||
|
* @date 2022/8/17 15:03
|
||||||
|
* @auth liyawei
|
||||||
|
*/
|
||||||
|
@Api(tags="搜索中心")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/search/lawsMonthlyReport")
|
||||||
|
@Slf4j
|
||||||
|
public class LawsMonthlyReportSearchController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ILawsMonthlyReportSearchService lawsMonthlyReportSearchService;
|
||||||
|
|
||||||
|
@ApiOperation(value="法规月报查询", notes="法规月报查询")
|
||||||
|
@PostMapping(value = "/page")
|
||||||
|
@RequiresPermissions("document:search")
|
||||||
|
public Result<?> queryPageInfo(@RequestBody SearchVO searchVO) {
|
||||||
|
IPage pageInfo = lawsMonthlyReportSearchService.pageInfo(searchVO);
|
||||||
|
return Result.OK(pageInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
package com.jero.modules.searchcenter.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.jero.modules.searchcenter.vo.SearchVO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 搜索中心-法规月报 接口
|
||||||
|
* @date 2022/8/17 15:03
|
||||||
|
* @auth liyawei
|
||||||
|
*/
|
||||||
|
public interface ILawsMonthlyReportSearchService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
* @param searchVO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
IPage pageInfo(SearchVO searchVO);
|
||||||
|
}
|
||||||
+261
@@ -0,0 +1,261 @@
|
|||||||
|
package com.jero.modules.searchcenter.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.jero.common.es.JeroElasticsearchTemplate;
|
||||||
|
import com.jero.modules.document.enums.SearchEnum;
|
||||||
|
import com.jero.modules.searchcenter.service.ILawsMonthlyReportSearchService;
|
||||||
|
import com.jero.modules.searchcenter.vo.SearchVO;
|
||||||
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 搜索中心-法规月报 服务层
|
||||||
|
* @date 2022/8/17 15:03
|
||||||
|
* @auth liyawei
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class LawsMonthlyReportSearchServiceImpl implements ILawsMonthlyReportSearchService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private JeroElasticsearchTemplate jeroElasticsearchTemplate;
|
||||||
|
public static final String SEARCH_FLAG = "魑";//标识(es数据带此标识的代表全文和段落的数据,不带此标识的代表列表数据)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全文
|
||||||
|
* @param searchVO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public IPage pageInfo(SearchVO searchVO) {
|
||||||
|
JSONArray queryJsonMustNot = new JSONArray();
|
||||||
|
// if(StringUtils.isNotBlank(searchVO.getSelectValue())){
|
||||||
|
// Map<String,Object> map = new HashMap<>();
|
||||||
|
// Map<String,Object> map1 = new HashMap<>();
|
||||||
|
// Map<String,Object> map2 = new HashMap<>();
|
||||||
|
// map.put("query",SEARCH_FLAG);
|
||||||
|
// map1.put("flag",map);
|
||||||
|
// map2.put("match",map1);
|
||||||
|
// queryJsonMustNot.add(map2);
|
||||||
|
// }
|
||||||
|
if(StringUtils.isBlank(searchVO.getSelectValue())){
|
||||||
|
searchVO.setSelectValue(SEARCH_FLAG);
|
||||||
|
}
|
||||||
|
|
||||||
|
//判断索引是否存在
|
||||||
|
boolean flagTemp = true;
|
||||||
|
flagTemp = jeroElasticsearchTemplate.indexExists(SearchEnum.INDEX_NAME_LAWS_MONTHLY_REPORT.getValue());
|
||||||
|
if (!flagTemp) {
|
||||||
|
return new Page(searchVO.getPageNo(), searchVO.getPageSize());
|
||||||
|
}
|
||||||
|
|
||||||
|
String selectValue = searchVO.getSelectValue();
|
||||||
|
String selectValueTwo = searchVO.getSelectValueTwo();
|
||||||
|
//1. 需要查询的字段
|
||||||
|
List<String> fieldList = new ArrayList<>();
|
||||||
|
fieldList.add("title");//权重5
|
||||||
|
fieldList.add("file_text");//权重4
|
||||||
|
fieldList.add("content");//权重3
|
||||||
|
fieldList.add("file_name"); //权重2
|
||||||
|
fieldList.add("module_type");
|
||||||
|
fieldList.add("id");
|
||||||
|
fieldList.add("flag");
|
||||||
|
|
||||||
|
JSONArray queryMapJson = new JSONArray();
|
||||||
|
JSONArray queryMapJsonTwo = new JSONArray();
|
||||||
|
JSONArray queryMapJsonThree = new JSONArray();
|
||||||
|
JSONArray queryMapJsonAll = new JSONArray();
|
||||||
|
|
||||||
|
Map<String,Object> mapHighlight = new HashMap<>();
|
||||||
|
Map<String,Object> mapHighlight1 = new HashMap<>();
|
||||||
|
//封装首次的条件
|
||||||
|
if (StringUtils.isNotBlank(selectValue)) {
|
||||||
|
for (String field : fieldList) {
|
||||||
|
Map<String, Object> map2 = new HashMap<>();
|
||||||
|
Map<String, Object> map3 = new HashMap<>();
|
||||||
|
Map<String, Object> map4 = new HashMap<>();
|
||||||
|
if("title".equals(field)){
|
||||||
|
map3.put("boost",1);
|
||||||
|
}else if("file_text".equals(field)){
|
||||||
|
map3.put("boost",0.01);
|
||||||
|
}else if("content".equals(field)){
|
||||||
|
map3.put("boost",0.01);
|
||||||
|
}else if("file_name".equals(field)){
|
||||||
|
map3.put("boost",1);
|
||||||
|
}
|
||||||
|
|
||||||
|
map3.put("query",selectValue);
|
||||||
|
map2.put(field, map3);
|
||||||
|
map4.put("match",map2);
|
||||||
|
queryMapJson.add(map4);
|
||||||
|
|
||||||
|
//高亮
|
||||||
|
if(!"flag".equals(field)){
|
||||||
|
highlight(mapHighlight, field);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mapHighlight1.put("fields",mapHighlight);
|
||||||
|
}
|
||||||
|
if(CollectionUtils.isNotEmpty(queryMapJson)){
|
||||||
|
JSONObject jsonObject = jeroElasticsearchTemplate.buildBoolQuery(null, null, queryMapJson);
|
||||||
|
queryMapJsonAll.add(jsonObject);
|
||||||
|
}
|
||||||
|
//封装二次的条件
|
||||||
|
if (StringUtils.isNotBlank(selectValueTwo)) {
|
||||||
|
for (String field : fieldList) {
|
||||||
|
Map<String, Object> queryMap = new HashMap<>();
|
||||||
|
Map<String, Object> map2 = new HashMap<>();
|
||||||
|
Map<String, Object> map3 = new HashMap<>();
|
||||||
|
if("title".equals(field)){
|
||||||
|
map3.put("boost",1);
|
||||||
|
}else if("file_text".equals(field)){
|
||||||
|
map3.put("boost",0.01);
|
||||||
|
}else if("content".equals(field)){
|
||||||
|
map3.put("boost",0.01);
|
||||||
|
}else if("file_name".equals(field)){
|
||||||
|
map3.put("boost",1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//特殊处理编号字段
|
||||||
|
map3.put("query",selectValueTwo);
|
||||||
|
// map3.put("minimum_should_match",2);
|
||||||
|
map2.put(field, map3);
|
||||||
|
queryMap.put("match", map2);
|
||||||
|
|
||||||
|
queryMapJsonTwo.add(queryMap);
|
||||||
|
//高亮
|
||||||
|
if(!"flag".equals(field)){
|
||||||
|
highlight(mapHighlight, field);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mapHighlight1.put("fields",mapHighlight);
|
||||||
|
}
|
||||||
|
if(CollectionUtils.isNotEmpty(queryMapJsonTwo)){
|
||||||
|
JSONObject jsonObjectTwo = jeroElasticsearchTemplate.buildBoolQuery(null, null, queryMapJsonTwo);
|
||||||
|
queryMapJsonAll.add(jsonObjectTwo);
|
||||||
|
}
|
||||||
|
//ids进行三次封装
|
||||||
|
if (StringUtils.isNotBlank(searchVO.getIds())) {
|
||||||
|
for (String s : searchVO.getIds().split(",")) {
|
||||||
|
Map<String, Object> queryMap = new HashMap<>();
|
||||||
|
Map<String, Object> queryMapTemp = new HashMap<>();
|
||||||
|
queryMapTemp.put("id", s);
|
||||||
|
queryMap.put("match_phrase", queryMapTemp);
|
||||||
|
queryMapJsonThree.add(queryMap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(CollectionUtils.isNotEmpty(queryMapJsonThree)){
|
||||||
|
JSONObject jsonObjectThree = jeroElasticsearchTemplate.buildBoolQuery(null, null, queryMapJsonThree);
|
||||||
|
queryMapJsonAll.add(jsonObjectThree);
|
||||||
|
}
|
||||||
|
JSONObject sort = new JSONObject();
|
||||||
|
Map<String,Object> issueTime = new HashMap<>();
|
||||||
|
Map<String,Object> issueTime1 = new HashMap<>();
|
||||||
|
issueTime.put("order","desc");
|
||||||
|
issueTime1.put("issue_time",issueTime);
|
||||||
|
sort.putAll(issueTime1);
|
||||||
|
|
||||||
|
// Map<String,Object> mapSort = new HashMap<>();
|
||||||
|
// Map<String,Object> mapSortTemp = new HashMap<>();
|
||||||
|
// mapSort.put("order","asc");
|
||||||
|
// mapSortTemp.put("file_sort.keyword",mapSort);
|
||||||
|
// sort.putAll(mapSortTemp);
|
||||||
|
|
||||||
|
Integer pageNo = searchVO.getPageNo();
|
||||||
|
Integer pageSize = searchVO.getPageSize();
|
||||||
|
IPage page = getiPage(selectValue, selectValueTwo, queryMapJsonAll, mapHighlight1,null,
|
||||||
|
pageNo, pageSize, null,searchVO.getCut(),sort,queryJsonMustNot);
|
||||||
|
return page;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private IPage getiPage(String selectValue, String selectValueTwo, JSONArray queryMapJson,Map<String,Object> highlightMap,
|
||||||
|
JSONArray should, Integer pageNo, Integer pageSize, String paragraphFlag,
|
||||||
|
String cut,JSONObject querySort,JSONArray queryMustNot) {
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
//基础添加封装
|
||||||
|
if ("paragraphFlag".equals(paragraphFlag)) {
|
||||||
|
jsonObject = jeroElasticsearchTemplate.buildBoolQuery(queryMapJson, queryMustNot, null);
|
||||||
|
} else {
|
||||||
|
jsonObject = jeroElasticsearchTemplate.buildBoolQuery(queryMapJson, queryMustNot, null);
|
||||||
|
}
|
||||||
|
JSONArray jsonArraySort = new JSONArray();
|
||||||
|
jsonArraySort.add(querySort);
|
||||||
|
|
||||||
|
//1. 条件,分页
|
||||||
|
JSONObject queryObject = jeroElasticsearchTemplate.buildQuery(null,
|
||||||
|
jsonObject,
|
||||||
|
highlightMap,
|
||||||
|
jsonArraySort,
|
||||||
|
pageNo-1,
|
||||||
|
pageSize);
|
||||||
|
//2. 数据查询
|
||||||
|
JSONObject search = new JSONObject();
|
||||||
|
search = jeroElasticsearchTemplate.search(SearchEnum.INDEX_NAME_LAWS_MONTHLY_REPORT.getValue(),
|
||||||
|
SearchEnum.TYPE_NAME_LAWS_MONTHLY_REPORT.getValue(),
|
||||||
|
queryObject);
|
||||||
|
|
||||||
|
List<Map<String, Object>> list = (List<Map<String, Object>>) (((Map) search.get("hits")).get("hits"));
|
||||||
|
List<Map<String, Object>> mapList = new ArrayList<>();
|
||||||
|
for (Map<String, Object> map : list) {
|
||||||
|
Map<String, Object> mapSource = (Map<String, Object>) map.get("_source");
|
||||||
|
Map<String, Object> mapHighlight = (Map<String, Object>) map.get("highlight");
|
||||||
|
if(ObjectUtils.isNotEmpty(mapHighlight)){
|
||||||
|
for (Map.Entry<String, Object> entry : mapHighlight.entrySet()) {
|
||||||
|
String key = entry.getKey();
|
||||||
|
List<String> value = (List<String>) entry.getValue();
|
||||||
|
String fieldConyent= "";
|
||||||
|
for (String s : value) {
|
||||||
|
fieldConyent += s;
|
||||||
|
}
|
||||||
|
mapSource.put(key,fieldConyent);
|
||||||
|
}
|
||||||
|
//如果这一条数据中有高亮字段值,但是file_text中没有高亮值, 则赋空值,否则列表中会展示所有的文件内容, 赋空后,则展示基础数据
|
||||||
|
String fileText = (String) mapSource.get("file_text");
|
||||||
|
if(StringUtils.isNotBlank(fileText) && !fileText.contains("<text class='highlight-class'>")){
|
||||||
|
mapSource.put("file_text","");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mapList.add(mapSource);
|
||||||
|
}
|
||||||
|
|
||||||
|
//处理分页
|
||||||
|
IPage page = new Page(pageNo, pageSize);
|
||||||
|
if (StringUtils.isNotBlank(selectValueTwo)) {
|
||||||
|
//二次搜索的结果
|
||||||
|
page.setTotal(Long.parseLong(String.valueOf(((Map) search.get("hits")).get("total"))));
|
||||||
|
page.setRecords(mapList);
|
||||||
|
} else {
|
||||||
|
//首次搜索的结果
|
||||||
|
page.setTotal(Long.parseLong(String.valueOf(((Map) search.get("hits")).get("total"))));
|
||||||
|
page.setRecords(mapList);
|
||||||
|
}
|
||||||
|
return page;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void highlight(Map<String, Object> mapHighlight, String key) {
|
||||||
|
Map<String, Object> mapTemp = new HashMap<>();
|
||||||
|
List<String> list = new ArrayList<>();
|
||||||
|
list.add("<text class='highlight-class'>");
|
||||||
|
List<String> list1 = new ArrayList<>();
|
||||||
|
list1.add("</text>");
|
||||||
|
mapTemp.put("pre_tags", list);
|
||||||
|
mapTemp.put("post_tags", list1);
|
||||||
|
mapTemp.put("fragment_size", 200);//高亮字段内容长度,去除html样式标签,统计字数,设置为200
|
||||||
|
mapTemp.put("number_of_fragments", 1);//高亮内容默认分为5段, 此处设置为一段
|
||||||
|
mapTemp.put("type", "plain");
|
||||||
|
mapHighlight.put(key, mapTemp);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -279,6 +279,11 @@ export default {
|
|||||||
/deep/.add-input{
|
/deep/.add-input{
|
||||||
min-height: 135px!important;
|
min-height: 135px!important;
|
||||||
}
|
}
|
||||||
|
::v-deep .page{
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<style lang='less'>
|
<style lang='less'>
|
||||||
.area-module {
|
.area-module {
|
||||||
@@ -292,9 +297,4 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.page{
|
|
||||||
display: flex;
|
|
||||||
justify-content: flex-end;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
@@ -240,6 +240,11 @@ export default {
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
::v-deep .page{
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<style lang='less'>
|
<style lang='less'>
|
||||||
.area-module {
|
.area-module {
|
||||||
@@ -253,9 +258,4 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.page{
|
|
||||||
display: flex;
|
|
||||||
justify-content: flex-end;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
@@ -150,6 +150,11 @@ export default {
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
::v-deep .page{
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<style lang='less'>
|
<style lang='less'>
|
||||||
.area-module {
|
.area-module {
|
||||||
@@ -163,9 +168,4 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.page{
|
|
||||||
display: flex;
|
|
||||||
justify-content: flex-end;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
@@ -348,6 +348,11 @@ export default {
|
|||||||
border: 1px #00B3BE solid;
|
border: 1px #00B3BE solid;
|
||||||
color: #00B3BE;
|
color: #00B3BE;
|
||||||
}
|
}
|
||||||
|
::v-deep .page{
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<style lang='less'>
|
<style lang='less'>
|
||||||
.area-module {
|
.area-module {
|
||||||
@@ -361,9 +366,4 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.page{
|
|
||||||
display: flex;
|
|
||||||
justify-content: flex-end;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
@@ -348,6 +348,11 @@ export default {
|
|||||||
border: 1px #00B3BE solid;
|
border: 1px #00B3BE solid;
|
||||||
color: #00B3BE;
|
color: #00B3BE;
|
||||||
}
|
}
|
||||||
|
::v-deep .page{
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<style lang='less'>
|
<style lang='less'>
|
||||||
.area-module {
|
.area-module {
|
||||||
@@ -361,9 +366,4 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.page{
|
|
||||||
display: flex;
|
|
||||||
justify-content: flex-end;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
rowKey="id"
|
rowKey="id"
|
||||||
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
|
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
|
||||||
:pagination="false"
|
:pagination="false"
|
||||||
:scroll="{x: '100%',y:'calc(100vh - 230px)'}"
|
:scroll="{x: '100%',y:'calc(100vh - 330px)'}"
|
||||||
:data-source="dataSource"
|
:data-source="dataSource"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
sticky
|
sticky
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
rowKey="id"
|
rowKey="id"
|
||||||
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
|
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
|
||||||
:pagination="false"
|
:pagination="false"
|
||||||
:scroll="{x: '100%',y:'calc(100vh - 230px)'}"
|
:scroll="{x: '100%',y:'calc(100vh - 330px)'}"
|
||||||
:data-source="dataSource"
|
:data-source="dataSource"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
sticky
|
sticky
|
||||||
|
|||||||
+1
-1
@@ -37,7 +37,7 @@
|
|||||||
</a-table>
|
</a-table>
|
||||||
<div class="page" v-if="dataSource.length > 0">
|
<div class="page" v-if="dataSource.length > 0">
|
||||||
<a-pagination
|
<a-pagination
|
||||||
:show-total="total => $t('total')+`${total}`+$t('strip')"
|
:show-total="total => $t('total')+` ${total} `+$t('strip')"
|
||||||
show-quick-jumper
|
show-quick-jumper
|
||||||
show-size-changer
|
show-size-changer
|
||||||
:page-size.sync="pageSize "
|
:page-size.sync="pageSize "
|
||||||
|
|||||||
@@ -86,7 +86,7 @@
|
|||||||
size="middle"
|
size="middle"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
:pagination="false"
|
:pagination="false"
|
||||||
:scroll="{x: '100%',y:'calc(100vh - 130px)'}"
|
:scroll="{x: '100%',y:'calc(100vh - 140px)'}"
|
||||||
rowKey="id"
|
rowKey="id"
|
||||||
:data-source="dataSource"
|
:data-source="dataSource"
|
||||||
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
|
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
|
||||||
|
|||||||
@@ -107,7 +107,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: this.$t('processBackground'),
|
title: this.$t('processBackground'),
|
||||||
value: 'processBackground'
|
value: 'processBackground',
|
||||||
|
type: 4
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
evaluatorFeedback: [
|
evaluatorFeedback: [
|
||||||
|
|||||||
@@ -130,6 +130,11 @@ export default {
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
::v-deep .page{
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<style lang='less'>
|
<style lang='less'>
|
||||||
.area-module {
|
.area-module {
|
||||||
@@ -143,9 +148,5 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.page{
|
|
||||||
display: flex;
|
|
||||||
justify-content: flex-end;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
@@ -41,236 +41,239 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { putAction, postAction, getAction, deleteAction } from '@/api/manage'
|
import { putAction, postAction, getAction, deleteAction } from '@/api/manage'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
||||||
import { queryDepartTreeList, searchByKeywords, deleteByDepartId } from '@/api/api'
|
import { queryDepartTreeList, searchByKeywords, deleteByDepartId } from '@/api/api'
|
||||||
import pick from 'lodash.pick'
|
import pick from 'lodash.pick'
|
||||||
export default {
|
|
||||||
name: 'diolagArea',
|
export default {
|
||||||
components: {},
|
name: 'diolagArea',
|
||||||
data() {
|
components: {},
|
||||||
return {
|
data() {
|
||||||
checkedDepartNameString: '',
|
return {
|
||||||
token:Vue.ls.get(ACCESS_TOKEN),
|
checkedDepartNameString: '',
|
||||||
title: this.$t('add'),
|
token: Vue.ls.get(ACCESS_TOKEN),
|
||||||
total: 0,
|
title: this.$t('add'),
|
||||||
selectedRowKeysDate: {},
|
total: 0,
|
||||||
loading: false,
|
selectedRowKeysDate: {},
|
||||||
editId: '',
|
loading: false,
|
||||||
newVisible: false,
|
editId: '',
|
||||||
selectedRole: undefined,
|
newVisible: false,
|
||||||
labelCol: {
|
selectedRole: undefined,
|
||||||
xs: { span: 24 },
|
labelCol: {
|
||||||
sm: { span: 7 }
|
xs: { span: 24 },
|
||||||
},
|
sm: { span: 7 }
|
||||||
wrapperCol: {
|
},
|
||||||
xs: { span: 24 },
|
wrapperCol: {
|
||||||
sm: { span: 14 }
|
xs: { span: 24 },
|
||||||
},
|
sm: { span: 14 }
|
||||||
form: {},
|
},
|
||||||
rules: {},
|
form: {},
|
||||||
areaTable: [],
|
rules: {},
|
||||||
flag: false, //表单提交标识
|
areaTable: [],
|
||||||
spinLoading: false,
|
flag: false, //表单提交标识
|
||||||
confirmLoading: false,
|
spinLoading: false,
|
||||||
selectedRowKeys: [],
|
confirmLoading: false,
|
||||||
roleList: [],
|
selectedRowKeys: [],
|
||||||
departTree: [],
|
roleList: [],
|
||||||
allTreeKeys: [],
|
departTree: [],
|
||||||
selectedKeys: [],
|
allTreeKeys: [],
|
||||||
checkStrictly: true,
|
selectedKeys: [],
|
||||||
checkedKeys: [],
|
checkStrictly: true,
|
||||||
}
|
checkedKeys: []
|
||||||
},
|
|
||||||
props: {
|
|
||||||
selectedRowKeysArray: {
|
|
||||||
type: Array,
|
|
||||||
default: [],
|
|
||||||
require: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.loadData()
|
|
||||||
this.loadTree()
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
loadTree() {
|
|
||||||
var that = this
|
|
||||||
that.treeData = []
|
|
||||||
that.departTree = []
|
|
||||||
queryDepartTreeList().then((res) => {
|
|
||||||
if (res.success) {
|
|
||||||
//部门全选后,再添加部门,选中数量增多
|
|
||||||
this.allTreeKeys = []
|
|
||||||
// console.log(res.result.length,'res.result.length')
|
|
||||||
for (let i = 0; i < res.result.length; i++) {
|
|
||||||
let temp = res.result[i]
|
|
||||||
// console.log(i,'oo')
|
|
||||||
// console.log(temp,'temptemp')
|
|
||||||
that.treeData.push(temp)
|
|
||||||
that.departTree.push(temp)
|
|
||||||
// console.log(that.departTree,'that.departTreethat.departTree')
|
|
||||||
// that.setThisExpandedKeys(temp)
|
|
||||||
// that.getAllKeys(temp)
|
|
||||||
// console.log(temp.id)
|
|
||||||
}
|
|
||||||
this.loading = false
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
setThisExpandedKeys(node) {
|
|
||||||
console.log(node,'setThisExpandedKeys')
|
|
||||||
if (node.children && node.children.length > 0) {
|
|
||||||
this.iExpandedKeys.push(node.key)
|
|
||||||
for (let a = 0; a < node.children.length; a++) {
|
|
||||||
this.setThisExpandedKeys(node.children[a])
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getAllKeys(node) {
|
props: {
|
||||||
console.log('getAllKeys',node);
|
selectedRowKeysArray: {
|
||||||
this.allTreeKeys.push(node.key)
|
type: Array,
|
||||||
if (node.children && node.children.length > 0) {
|
default: [],
|
||||||
for (let a = 0; a < node.children.length; a++) {
|
require: true
|
||||||
this.getAllKeys(node.children[a])
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onExpand(expandedKeys) {
|
mounted() {
|
||||||
console.log(expandedKeys,'expandedKeys')
|
this.loadData()
|
||||||
this.iExpandedKeys = expandedKeys
|
this.loadTree()
|
||||||
},
|
},
|
||||||
// 触发onSelect事件时,为部门树右侧的form表单赋值
|
methods: {
|
||||||
setValuesToForm(record) {
|
loadTree() {
|
||||||
if (record.orgCategory == '1') {
|
var that = this
|
||||||
this.orgCategoryDisabled = true
|
that.treeData = []
|
||||||
} else {
|
that.departTree = []
|
||||||
this.orgCategoryDisabled = false
|
queryDepartTreeList().then((res) => {
|
||||||
}
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.form.getFieldDecorator('fax', { initialValue: '' })
|
|
||||||
this.form.setFieldsValue(pick(record, 'departName', 'orgCategory', 'orgCode', 'departOrder', 'mobile', 'fax', 'address', 'memo'))
|
|
||||||
})
|
|
||||||
},
|
|
||||||
// 右键操作方法
|
|
||||||
rightHandle(node) {
|
|
||||||
console.log(node)
|
|
||||||
this.dropTrigger = 'contextmenu'
|
|
||||||
console.log(node.node.eventKey)
|
|
||||||
this.rightClickSelectedKey = node.node.eventKey
|
|
||||||
this.rightClickSelectedOrgCode = node.node.dataRef.orgCode
|
|
||||||
},
|
|
||||||
onCheck(checkedKeys,info) {
|
|
||||||
// console.log(checkedKeys,info)
|
|
||||||
this.hiding = false
|
|
||||||
if (this.checkStrictly) {
|
|
||||||
this.checkedKeys = checkedKeys.checked
|
|
||||||
} else {
|
|
||||||
this.checkedKeys = checkedKeys
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onSelect(selectedKeys, e) {
|
|
||||||
console.log(selectedKeys,e)
|
|
||||||
this.hiding = false
|
|
||||||
let record = e.node.dataRef
|
|
||||||
this.currSelected = Object.assign({}, record)
|
|
||||||
this.model = this.currSelected
|
|
||||||
this.selectedKeys = [record.key]
|
|
||||||
this.model.parentId = record.parentId
|
|
||||||
this.setValuesToForm(record)
|
|
||||||
this.recordTab = record
|
|
||||||
// this.$refs.departAuth.show(record.id)
|
|
||||||
// 传用户信息参数
|
|
||||||
if (this.$refs.DeptUserInfo) {
|
|
||||||
this.$refs.DeptUserInfo.open(record)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onSearch(value) {
|
|
||||||
let that = this
|
|
||||||
if (value) {
|
|
||||||
searchByKeywords({ keyWord: value }).then((res) => {
|
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
that.departTree = []
|
//部门全选后,再添加部门,选中数量增多
|
||||||
|
this.allTreeKeys = []
|
||||||
|
// console.log(res.result.length,'res.result.length')
|
||||||
for (let i = 0; i < res.result.length; i++) {
|
for (let i = 0; i < res.result.length; i++) {
|
||||||
let temp = res.result[i]
|
let temp = res.result[i]
|
||||||
|
// console.log(i,'oo')
|
||||||
|
// console.log(temp,'temptemp')
|
||||||
|
that.treeData.push(temp)
|
||||||
that.departTree.push(temp)
|
that.departTree.push(temp)
|
||||||
|
// console.log(that.departTree,'that.departTreethat.departTree')
|
||||||
|
// that.setThisExpandedKeys(temp)
|
||||||
|
// that.getAllKeys(temp)
|
||||||
|
// console.log(temp.id)
|
||||||
}
|
}
|
||||||
} else {
|
this.loading = false
|
||||||
that.$message.warning(res.message)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
},
|
||||||
that.loadTree()
|
setThisExpandedKeys(node) {
|
||||||
}
|
console.log(node, 'setThisExpandedKeys')
|
||||||
|
if (node.children && node.children.length > 0) {
|
||||||
},
|
this.iExpandedKeys.push(node.key)
|
||||||
loadData() {
|
for (let a = 0; a < node.children.length; a++) {
|
||||||
this.loading = true
|
this.setThisExpandedKeys(node.children[a])
|
||||||
getAction(`sys/role/queryall`, {}).then(res => {
|
}
|
||||||
if (res.success) {
|
|
||||||
this.roleList = [...res.result]
|
|
||||||
}
|
}
|
||||||
}).finally(() => {
|
},
|
||||||
this.loading = false
|
getAllKeys(node) {
|
||||||
})
|
console.log('getAllKeys', node)
|
||||||
},
|
this.allTreeKeys.push(node.key)
|
||||||
handleCancel() {
|
if (node.children && node.children.length > 0) {
|
||||||
this.$emit('departmentvisible', false)
|
for (let a = 0; a < node.children.length; a++) {
|
||||||
},
|
this.getAllKeys(node.children[a])
|
||||||
//保存
|
}
|
||||||
handleSubmit() {
|
}
|
||||||
let param = {ids: this.selectedRowKeysArray.join(','), selecteddeparts: `${this.checkedKeys.join(',')}` }
|
},
|
||||||
postAction('/sys/user/setDepart', param).then((res) => {
|
onExpand(expandedKeys) {
|
||||||
if (res.success) {
|
console.log(expandedKeys, 'expandedKeys')
|
||||||
this.$emit('departmentvisible', false)
|
this.iExpandedKeys = expandedKeys
|
||||||
this.$message.success(res.message)
|
},
|
||||||
|
// 触发onSelect事件时,为部门树右侧的form表单赋值
|
||||||
|
setValuesToForm(record) {
|
||||||
|
if (record.orgCategory == '1') {
|
||||||
|
this.orgCategoryDisabled = true
|
||||||
} else {
|
} else {
|
||||||
this.$message.warning(res.message)
|
this.orgCategoryDisabled = false
|
||||||
}
|
}
|
||||||
})
|
this.$nextTick(() => {
|
||||||
|
this.form.getFieldDecorator('fax', { initialValue: '' })
|
||||||
|
this.form.setFieldsValue(pick(record, 'departName', 'orgCategory', 'orgCode', 'departOrder', 'mobile', 'fax', 'address', 'memo'))
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 右键操作方法
|
||||||
|
rightHandle(node) {
|
||||||
|
console.log(node)
|
||||||
|
this.dropTrigger = 'contextmenu'
|
||||||
|
console.log(node.node.eventKey)
|
||||||
|
this.rightClickSelectedKey = node.node.eventKey
|
||||||
|
this.rightClickSelectedOrgCode = node.node.dataRef.orgCode
|
||||||
|
},
|
||||||
|
onCheck(checkedKeys, info) {
|
||||||
|
// console.log(checkedKeys,info)
|
||||||
|
this.hiding = false
|
||||||
|
if (this.checkStrictly) {
|
||||||
|
this.checkedKeys = checkedKeys.checked
|
||||||
|
} else {
|
||||||
|
this.checkedKeys = checkedKeys
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onSelect(selectedKeys, e) {
|
||||||
|
console.log(selectedKeys, e)
|
||||||
|
this.hiding = false
|
||||||
|
let record = e.node.dataRef
|
||||||
|
this.currSelected = Object.assign({}, record)
|
||||||
|
this.model = this.currSelected
|
||||||
|
this.selectedKeys = [record.key]
|
||||||
|
this.model.parentId = record.parentId
|
||||||
|
this.setValuesToForm(record)
|
||||||
|
this.recordTab = record
|
||||||
|
// this.$refs.departAuth.show(record.id)
|
||||||
|
// 传用户信息参数
|
||||||
|
if (this.$refs.DeptUserInfo) {
|
||||||
|
this.$refs.DeptUserInfo.open(record)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onSearch(value) {
|
||||||
|
let that = this
|
||||||
|
if (value) {
|
||||||
|
searchByKeywords({ keyWord: value }).then((res) => {
|
||||||
|
if (res.success) {
|
||||||
|
that.departTree = []
|
||||||
|
for (let i = 0; i < res.result.length; i++) {
|
||||||
|
let temp = res.result[i]
|
||||||
|
that.departTree.push(temp)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
that.$message.warning(res.message)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
that.loadTree()
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
loadData() {
|
||||||
|
this.loading = true
|
||||||
|
getAction(`sys/role/queryall`, {}).then(res => {
|
||||||
|
if (res.success) {
|
||||||
|
this.roleList = [...res.result]
|
||||||
|
}
|
||||||
|
}).finally(() => {
|
||||||
|
this.loading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleCancel() {
|
||||||
|
this.$emit('departmentvisible', false)
|
||||||
|
},
|
||||||
|
//保存
|
||||||
|
handleSubmit() {
|
||||||
|
let param = { ids: this.selectedRowKeysArray.join(','), selecteddeparts: `${this.checkedKeys.join(',')}` }
|
||||||
|
postAction('/sys/user/setDepart', param).then((res) => {
|
||||||
|
if (res.success) {
|
||||||
|
this.$emit('departmentvisible', false)
|
||||||
|
this.$message.success(res.message)
|
||||||
|
} else {
|
||||||
|
this.$message.warning(res.message)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang='less' scoped>
|
<style lang='less' scoped>
|
||||||
@import '~@assets/less/common.less';
|
@import '~@assets/less/common.less';
|
||||||
|
|
||||||
.diolag-area {
|
.diolag-area {
|
||||||
.table-area {
|
.table-area {
|
||||||
margin: 20px 0;
|
margin: 20px 0;
|
||||||
|
|
||||||
.action-edit {
|
.action-edit {
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-del {
|
||||||
|
color: red;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.table-del {
|
.drawer-bootom-button {
|
||||||
color: red;
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep .page {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
.drawer-bootom-button{
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
<style lang='less'>
|
<style lang='less'>
|
||||||
.area-module {
|
.area-module {
|
||||||
.ant-modal-wrap {
|
.ant-modal-wrap {
|
||||||
.ant-modal {
|
.ant-modal {
|
||||||
.ant-modal-content {
|
.ant-modal-content {
|
||||||
.ant-modal-footer {
|
.ant-modal-footer {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
.page{
|
|
||||||
display: flex;
|
|
||||||
justify-content: flex-end;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
Reference in New Issue
Block a user