feat(web): 更新数据市场展示逻辑
- 公开数据采用卡片模式展示,增加申请授权功能 - 后端增加 icon 字段,用于展示数据资源图标
This commit is contained in:
@@ -7,81 +7,7 @@ import {
|
|||||||
permissionStateMapping,
|
permissionStateMapping,
|
||||||
timeField
|
timeField
|
||||||
} from "../../components/constants.js";
|
} from "../../components/constants.js";
|
||||||
|
import {authenticationAddDialog} from "../../components/permission/dialog-permission.js";
|
||||||
function listColumns() {
|
|
||||||
return {
|
|
||||||
columns: [
|
|
||||||
{
|
|
||||||
name: 'name',
|
|
||||||
label: '名称',
|
|
||||||
width: 200,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'description',
|
|
||||||
label: '描述',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
visibleOn: '${!public}',
|
|
||||||
...mappingField('state', '状态', permissionStateMapping)
|
|
||||||
},
|
|
||||||
timeField('createdTime', '创建时间'),
|
|
||||||
operationField('操作', undefined, [
|
|
||||||
{
|
|
||||||
type: 'action',
|
|
||||||
label: '查看',
|
|
||||||
level: 'link',
|
|
||||||
...wareDetailDialog(),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
visibleOn: "${state === 'CHECKING'}",
|
|
||||||
type: 'action',
|
|
||||||
label: '撤销',
|
|
||||||
level: 'link',
|
|
||||||
confirmTitle: '确认撤销',
|
|
||||||
confirmText: '确认撤销名称为「${name}」的确权申请吗?',
|
|
||||||
actionType: 'ajax',
|
|
||||||
api: apiGet('${base}/ware/retract/${id}'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
visibleOn: "${state === 'DRAFT' || state === 'REJECT'}",
|
|
||||||
type: 'action',
|
|
||||||
label: '提交',
|
|
||||||
level: 'link',
|
|
||||||
confirmTitle: '确认提交',
|
|
||||||
confirmText: '确认提交名称为「${name}」的确权申请吗?',
|
|
||||||
actionType: 'ajax',
|
|
||||||
api: apiGet('${base}/ware/submit/${id}'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
visibleOn: "${!public}",
|
|
||||||
type: 'dropdown-button',
|
|
||||||
level: 'link',
|
|
||||||
icon: 'fa fa-ellipsis-h',
|
|
||||||
hideCaret: true,
|
|
||||||
trigger: 'hover',
|
|
||||||
buttons: [
|
|
||||||
{
|
|
||||||
disabledOn: "${state !== 'DRAFT'}",
|
|
||||||
type: 'action',
|
|
||||||
label: '编辑',
|
|
||||||
level: 'link',
|
|
||||||
...wareEditeDialog(),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
disabledOn: "${state === 'CHECKING'}",
|
|
||||||
type: 'action',
|
|
||||||
label: "删除",
|
|
||||||
confirmTitle: '确认删除',
|
|
||||||
confirmText: '确认删除名称为「${name}」的确权申请吗?删除后对应的数据资源处于未确权状态。',
|
|
||||||
actionType: 'ajax',
|
|
||||||
api: apiGet('${base}/ware/remove/${id}'),
|
|
||||||
},
|
|
||||||
]
|
|
||||||
},
|
|
||||||
]),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function tabMarket() {
|
export function tabMarket() {
|
||||||
return {
|
return {
|
||||||
@@ -96,15 +22,47 @@ export function tabMarket() {
|
|||||||
title: '公开数据',
|
title: '公开数据',
|
||||||
body: {
|
body: {
|
||||||
type: 'crud',
|
type: 'crud',
|
||||||
api: apiGet('${base}/ware/list_public'),
|
api: {
|
||||||
|
...apiGet('${base}/ware/list_public'),
|
||||||
|
adaptor: (payload, response, api, context) => {
|
||||||
|
payload.data = payload.data.map(i => {
|
||||||
|
return {
|
||||||
|
...i,
|
||||||
|
targetId: i.id
|
||||||
|
}
|
||||||
|
})
|
||||||
|
console.log(payload, response, api, context)
|
||||||
|
return {
|
||||||
|
...payload
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
...crudCommonOptions(),
|
...crudCommonOptions(),
|
||||||
headerToolbar: [
|
headerToolbar: [
|
||||||
'reload',
|
'reload',
|
||||||
],
|
],
|
||||||
data: {
|
mode: 'cards',
|
||||||
public: true
|
card: {
|
||||||
|
header: {
|
||||||
|
title: '${name}',
|
||||||
|
subTitle: '${createdTime}',
|
||||||
|
description: '${description}',
|
||||||
|
avatar: '${icon}',
|
||||||
|
avatarClassName: 'pull-left thumb-md avatar b-3x m-r'
|
||||||
|
},
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
type: 'action',
|
||||||
|
label: '查看',
|
||||||
|
...wareDetailDialog(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'action',
|
||||||
|
label: '申请授权',
|
||||||
|
...authenticationAddDialog(),
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
...listColumns(),
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -122,7 +80,73 @@ export function tabMarket() {
|
|||||||
...wareAddDialog()
|
...wareAddDialog()
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
...listColumns(),
|
columns: [
|
||||||
|
{
|
||||||
|
name: 'name',
|
||||||
|
label: '名称',
|
||||||
|
width: 200,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'description',
|
||||||
|
label: '描述',
|
||||||
|
},
|
||||||
|
mappingField('state', '状态', permissionStateMapping),
|
||||||
|
timeField('createdTime', '创建时间'),
|
||||||
|
operationField('操作', undefined, [
|
||||||
|
{
|
||||||
|
type: 'action',
|
||||||
|
label: '查看',
|
||||||
|
level: 'link',
|
||||||
|
...wareDetailDialog(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
visibleOn: "${state === 'CHECKING'}",
|
||||||
|
type: 'action',
|
||||||
|
label: '撤销',
|
||||||
|
level: 'link',
|
||||||
|
confirmTitle: '确认撤销',
|
||||||
|
confirmText: '确认撤销名称为「${name}」的确权申请吗?',
|
||||||
|
actionType: 'ajax',
|
||||||
|
api: apiGet('${base}/ware/retract/${id}'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
visibleOn: "${state === 'DRAFT' || state === 'REJECT'}",
|
||||||
|
type: 'action',
|
||||||
|
label: '提交',
|
||||||
|
level: 'link',
|
||||||
|
confirmTitle: '确认提交',
|
||||||
|
confirmText: '确认提交名称为「${name}」的确权申请吗?',
|
||||||
|
actionType: 'ajax',
|
||||||
|
api: apiGet('${base}/ware/submit/${id}'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
visibleOn: "${!public}",
|
||||||
|
type: 'dropdown-button',
|
||||||
|
level: 'link',
|
||||||
|
icon: 'fa fa-ellipsis-h',
|
||||||
|
hideCaret: true,
|
||||||
|
trigger: 'hover',
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
disabledOn: "${state !== 'DRAFT'}",
|
||||||
|
type: 'action',
|
||||||
|
label: '编辑',
|
||||||
|
level: 'link',
|
||||||
|
...wareEditeDialog(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
disabledOn: "${state === 'CHECKING'}",
|
||||||
|
type: 'action',
|
||||||
|
label: "删除",
|
||||||
|
confirmTitle: '确认删除',
|
||||||
|
confirmText: '确认删除名称为「${name}」的确权申请吗?删除后对应的数据资源处于未确权状态。',
|
||||||
|
actionType: 'ajax',
|
||||||
|
api: apiGet('${base}/ware/remove/${id}'),
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
]),
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ public class WareController extends SimpleControllerSupport<Ware, WareController
|
|||||||
item.setId(entity.getId());
|
item.setId(entity.getId());
|
||||||
item.setName(entity.getName());
|
item.setName(entity.getName());
|
||||||
item.setDescription(entity.getDescription());
|
item.setDescription(entity.getDescription());
|
||||||
|
item.setIcon(StrUtil.format("{}/upload/download/{}", hostConfiguration.getPrefix(), entity.getIcon().getId()));
|
||||||
item.setState(entity.getState().name());
|
item.setState(entity.getState().name());
|
||||||
item.setCreatedTime(entity.getCreatedTime());
|
item.setCreatedTime(entity.getCreatedTime());
|
||||||
item.setCreatedUsername(entity.getCreatedUser().getUsername());
|
item.setCreatedUsername(entity.getCreatedUser().getUsername());
|
||||||
@@ -117,6 +118,7 @@ public class WareController extends SimpleControllerSupport<Ware, WareController
|
|||||||
private String name;
|
private String name;
|
||||||
private String description;
|
private String description;
|
||||||
private String state;
|
private String state;
|
||||||
|
private String icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
|||||||
@DynamicUpdate
|
@DynamicUpdate
|
||||||
@Table(name = Constants.TABLE_PREFIX + "ware")
|
@Table(name = Constants.TABLE_PREFIX + "ware")
|
||||||
@NamedEntityGraph(name = "ware.list", attributeNodes = {
|
@NamedEntityGraph(name = "ware.list", attributeNodes = {
|
||||||
|
@NamedAttributeNode(value = "icon"),
|
||||||
@NamedAttributeNode(value = "createdUser"),
|
@NamedAttributeNode(value = "createdUser"),
|
||||||
})
|
})
|
||||||
@NamedEntityGraph(name = "ware.detail", attributeNodes = {
|
@NamedEntityGraph(name = "ware.detail", attributeNodes = {
|
||||||
|
|||||||
Reference in New Issue
Block a user