Merge remote-tracking branch 'origin/master'

This commit is contained in:
liyawei
2022-02-24 10:56:29 +08:00
5 changed files with 90 additions and 56 deletions
@@ -28,7 +28,7 @@ import java.util.Date;
@Accessors(chain = true) @Accessors(chain = true)
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@ApiModel(value="onl_cgform_collection对象", description="我的收藏") @ApiModel(value="onl_cgform_collection对象", description="我的收藏")
public class OnlCgformCollection extends BussDocumentLibraryEO implements Serializable { public class OnlCgformCollection implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/**主键*/ /**主键*/
@@ -60,21 +60,4 @@ public class OnlCgformCollection extends BussDocumentLibraryEO implements Serial
@Excel(name = "文档库id", width = 15, dictTable = "buss_document_library", dicText = "id", dicCode = "id") @Excel(name = "文档库id", width = 15, dictTable = "buss_document_library", dicText = "id", dicCode = "id")
@Dict(dictTable = "buss_document_library", dicText = "id", dicCode = "id") @Dict(dictTable = "buss_document_library", dicText = "id", dicCode = "id")
private String documentId; private String documentId;
/**状态*/
@Excel(name = "状态", width = 15, dictTable = "buss_document_library", dicText = "state", dicCode = "state")
@Dict(dictTable = "buss_document_library", dicText = "state", dicCode = "state")
private String state;
/**编号*/
@Excel(name = "编号", width = 15, dictTable = "buss_document_library", dicText = "serialNumber", dicCode = "serialNumber")
@Dict(dictTable = "buss_document_library", dicText = "serialNumber", dicCode = "serialNumber")
private String serialNumber;
/**标题*/
@Excel(name = "标题", width = 15, dictTable = "buss_document_library", dicText = "title", dicCode = "title")
@Dict(dictTable = "buss_document_library", dicText = "title", dicCode = "title")
@ApiModelProperty(value = "标题")
private String title;
} }
@@ -691,9 +691,11 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
//数据字典 //数据字典
List<SysDictItem> sysDictItems = sysDictItemServiceImpl.selectItemsAll(); List<SysDictItem> sysDictItems = sysDictItemServiceImpl.selectItemsAll();
//下拉选处理数据字典 //下拉选处理数据字典
List records = infoPage.getRecords(); List<Map> records = infoPage.getRecords();
for (Object record : records) { List<String> idList = new ArrayList<>();
for (Map record : records) {
Map<String, Object> record1 = (Map) record; Map<String, Object> record1 = (Map) record;
idList.add((String) record1.get("id"));
for (Map.Entry<String, Object> entry : record1.entrySet()) { for (Map.Entry<String, Object> entry : record1.entrySet()) {
List<OnlCgformField> collect = fieldList.stream() List<OnlCgformField> collect = fieldList.stream()
.filter(e -> entry.getKey().equals(e.getDictField())) .filter(e -> entry.getKey().equals(e.getDictField()))
@@ -702,8 +704,45 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
dictItem(sysDictItems, entry, collect); dictItem(sysDictItems, entry, collect);
} }
} }
//收藏和订阅
collectAndSubscribe(records, idList);
return infoPage; return infoPage;
}
/**
* 收藏和订阅
* @param records
* @param idList
*/
private void collectAndSubscribe(List<Map> records, List<String> idList) {
//收藏
LambdaQueryWrapper<OnlCgformCollection> wrapper = new LambdaQueryWrapper<>();
wrapper.in(OnlCgformCollection::getDocumentId,idList);
List<OnlCgformCollection> collectList = iOnlCgformCollectionService.list(wrapper);
List<String> collectIdList = collectList.stream().map(OnlCgformCollection::getDocumentId).collect(Collectors.toList());
//订阅
LambdaQueryWrapper<OnlCgformSubscribe> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(OnlCgformSubscribe::getDocumentId,idList);
List<OnlCgformSubscribe> subscribeList = iOnlCgformSubscribeService.list(lambdaQueryWrapper);
List<String> subscribeIdList = subscribeList.stream().map(OnlCgformSubscribe::getDocumentId).collect(Collectors.toList());
for (Map record : records) {
Map<String, Object> record1 = (Map) record;
String id = (String) record1.get("id");
//收藏标识(0-->未收藏 1-->已收藏)
if(collectIdList.contains(id)){
record1.put("collectFlag","1");
}else{
record1.put("collectFlag","0");
}
//订阅标识
if(subscribeIdList.contains(id)){
record1.put("subscribeFlag","1");
}else{
record1.put("subscribeFlag","0");
}
}
} }
/** /**
@@ -63,27 +63,4 @@ public class OnlCgformSubscribe implements Serializable {
@Excel(name = "文档库id", width = 15, dictTable = "buss_document_library", dicText = "id", dicCode = "id") @Excel(name = "文档库id", width = 15, dictTable = "buss_document_library", dicText = "id", dicCode = "id")
@Dict(dictTable = "buss_document_library", dicText = "id", dicCode = "id") @Dict(dictTable = "buss_document_library", dicText = "id", dicCode = "id")
private String documentId; private String documentId;
/**状态*/
@Excel(name = "状态", width = 15, dictTable = "buss_document_library", dicText = "state", dicCode = "state")
@Dict(dictTable = "buss_document_library", dicText = "state", dicCode = "state")
private String state;
/**编号*/
@Excel(name = "编号", width = 15, dictTable = "buss_document_library", dicText = "serialNumber", dicCode = "serialNumber")
@Dict(dictTable = "buss_document_library", dicText = "serialNumber", dicCode = "serialNumber")
private String serialNumber;
/**标题*/
@Excel(name = "标题", width = 15, dictTable = "buss_document_library", dicText = "title", dicCode = "title")
@Dict(dictTable = "buss_document_library", dicText = "title", dicCode = "title")
@ApiModelProperty(value = "标题")
private String title;
/**技术领域*/
@Excel(name = "技术领域", width = 15)
@Dict(dicCode = "technology_territory")
@ApiModelProperty(value = "技术领域")
private String technologyTerritory;
} }
+20 -6
View File
@@ -14,7 +14,17 @@
> >
<span slot="operation" slot-scope="record"> <span slot="operation" slot-scope="record">
<a class="text" v-for="(ol,index) in OperationList" <a class="text" v-for="(ol,index) in OperationList"
@click="OperationClick(ol,record)">{{ ol.text instanceof Array ? ol.text[record.collectFlag || 0] : ol.text}}</a> @click="OperationClick(ol,record)">
<span v-if="ol.text == '收藏'">
{{!record.collectFlag || record.collectFlag == 0 ? '收藏' :'取消收藏'}}
</span>
<span v-else-if="ol.text == '订阅'">
{{!record.subscribeFlag || record.subscribeFlag == 0 ? '订阅' :'取消订阅'}}
</span>
<span v-else>
{{ol.text}}
</span>
</a>
</span> </span>
<span slot="detailClick" slot-scope="text,record"> <span slot="detailClick" slot-scope="text,record">
<a class="text" @click="detailClick(record)">{{text}}</a> <a class="text" @click="detailClick(record)">{{text}}</a>
@@ -88,10 +98,12 @@
} }
}) })
this.searchParmes = search this.searchParmes = search
this.getData()
this.getTableList() this.getTableList()
}) })
eventBUs.$on('searchReset', target => { eventBUs.$on('searchReset', target => {
this.searchParmes = {} this.searchParmes = {}
this.getData()
this.getTableList() this.getTableList()
}) })
this.getData() this.getData()
@@ -119,9 +131,11 @@
} }
} }
}) })
let width let width = 0
if (this.OperationList.length > 0) { if (this.OperationList.length > 0) {
width = this.OperationList.length * 55 this.OperationList.forEach((res) => {
width += res.text.length * 8 + width
})
} }
if (this.showAction) { if (this.showAction) {
this.columns.push({ this.columns.push({
@@ -174,9 +188,9 @@
OperationClick(ol, item) { OperationClick(ol, item) {
this.$emit(ol.ClickEvent, item) this.$emit(ol.ClickEvent, item)
}, },
detailClick(item){ detailClick(item, index) {
this.$emit('detailClick',item) this.$emit('detailClick',item)
}, }
} }
} }
</script> </script>
@@ -65,11 +65,11 @@
return { return {
OperationList: [ OperationList: [
{ {
text: ['收藏','取消收藏'], text: '收藏',
ClickEvent: 'Collection' ClickEvent: 'Collection'
}, },
{ {
text: ['订阅','取消订阅'], text: '订阅',
ClickEvent: 'subscribe' ClickEvent: 'subscribe'
}, },
{ {
@@ -171,12 +171,12 @@
Collection(val) { Collection(val) {
let _this = this let _this = this
this.$confirm({ this.$confirm({
content: val.collectFlag == 0 || !val.collectFlag ? '确认收藏?':'确定取消收藏', content: val.collectFlag == 0 || !val.collectFlag ? '确认收藏?' : '确定取消收藏?',
onOk() { onOk() {
let url = '' let url = ''
if (val.collectFlag == 0 || !val.collectFlag){ if (val.collectFlag == 0 || !val.collectFlag) {
url = 'document/bussDocumentLibraryEO/addCollect' url = 'document/bussDocumentLibraryEO/addCollect'
}else{ } else {
url = 'document/bussDocumentLibraryEO/cancelCollect' url = 'document/bussDocumentLibraryEO/cancelCollect'
} }
getAction(url, { id: val.id }).then((res) => { getAction(url, { id: val.id }).then((res) => {
@@ -192,17 +192,38 @@
}, },
//订阅按钮 //订阅按钮
subscribe(val) { subscribe(val) {
console.log('val222', val) let _this = this
this.$confirm({
content: val.subscribeFlag == 0 || !val.subscribeFlag ? '确认订阅?' : '确定取消订阅?',
onOk() {
let url = ''
if (val.subscribeFlag == 0 || !val.subscribeFlag) {
url = 'document/bussDocumentLibraryEO/addSubscribe'
} else {
url = 'document/bussDocumentLibraryEO/cancelSubscribe'
}
getAction(url, { id: val.id }).then((res) => {
if (res.success) {
_this.$message.success(res.message)
eventBUs.$emit('searchReset')
} else {
_this.$message.warning(res.message)
}
})
}
})
}, },
onSelectChange(value) { onSelectChange(value) {
this.idList = value this.idList = value
}, },
detailClick(item) { detailClick(item) {
this.$router.push({ this.$router.push({
path: '/docManage/library/detail', path: '/docManage/library/detail',
query: item query: item
}) })
} },
} }
} }
</script> </script>