1
0

feat(web): 实现数据产品上架审核功能

- 新增数据产品列表、详情、编辑等功能页面
- 实现数据产品提交审核、撤销审核、同意审核等操作
- 优化数据产品相关API接口,支持审核功能
- 重构部分代码以支持新功能
This commit is contained in:
2024-12-17 18:29:16 +08:00
parent 4934c6727e
commit 3138539bc5
12 changed files with 377 additions and 60 deletions

View File

@@ -1,5 +1,5 @@
export const information = {
debug: true,
debug: false,
// baseUrl: '',
baseUrl: 'http://127.0.0.1:20080',
title: '可信供给中心',
@@ -262,6 +262,7 @@ export const permissionStateMapping = [
export const checkTypeMapping = [
mappingItem('确权审查', 'CONFIRMATION', 'bg-blue-500'),
mappingItem('授权审查', 'AUTHENTICATION', 'bg-purple-500'),
mappingItem('上架审查', 'MARKET', 'bg-green-500'),
]
export const checkOverMapping = [

View File

@@ -5,6 +5,7 @@ import {resourceDetailDialog} from '../resource/dialog-resource.js'
function detailForm() {
return {
id: 'ware-form',
debug: information.debug,
type: 'form',
...horizontalFormOptions(),
@@ -17,13 +18,38 @@ function detailForm() {
name: 'id',
},
{
visibleOn: '${!detail}',
type: 'input-image',
name: 'icon',
label: '图标',
required: true,
receiver: apiPost("${base}/upload"),
autoFill: {
iconId: '${id}',
onEvent: {
success: {
actions: [
{
actionType: 'setValue',
componentId: 'ware-form',
args: {
value: {
iconId: '${event.data.result.id}'
}
}
}
]
}
}
},
{
visibleOn: '${detail}',
type: 'control',
name: 'icon',
label: '图标',
required: true,
body: {
type: 'image',
src: '${icon}',
innerClassName: 'no-border',
}
},
{
@@ -79,7 +105,7 @@ function detailForm() {
name: 'content',
label: '商品详情',
required: true,
receiver: '',
receiver: apiPost("${base}/upload"),
options: {
min_height: 300,
}
@@ -108,21 +134,28 @@ export function wareAddDialog() {
body: {
...detailForm(),
api: apiPost(`\${base}/ware/save`),
data: {
add: true,
}
}
}
}
}
export function wareDetailDialog() {
export function wareDetailDialog(field = 'id', actions = []) {
return {
actionType: 'dialog',
dialog: {
title: '确权申请详情',
title: '数据产品详情',
size: 'md',
actions: actions,
body: {
...detailForm(),
initApi: apiGet(`\${base}/ware/detail/\${id}`),
initApi: apiGet(`\${base}/ware/detail/\${${field}}`),
static: true,
data: {
detail: true,
}
}
}
}
@@ -132,7 +165,7 @@ export function wareEditeDialog() {
return {
actionType: 'dialog',
dialog: {
title: '确权申请详情',
title: '数据产品详情',
size: 'md',
actions: [
{
@@ -148,7 +181,10 @@ export function wareEditeDialog() {
body: {
...detailForm(),
api: apiPost(`\${base}/ware/save`),
initApi: apiGet(`\${base}/ware/detail/\${${field}}`),
initApi: apiGet(`\${base}/ware/detail/\${id}`),
data: {
edit: true
}
},
}
}

View File

@@ -10,6 +10,7 @@ import {
timeField,
} from "../../components/constants.js";
import {authenticationDetailDialog, confirmationDetailDialog} from "../../components/permission/dialog-permission.js";
import {wareDetailDialog} from "../../components/ware/dialog-ware.js";
export function tabCheck() {
return {
@@ -103,6 +104,40 @@ export function tabCheck() {
level: 'link',
...authenticationDetailDialog('parameters.authenticationId'),
},
{
visibleOn: `\${type === 'MARKET' && state === 'CHECKING'}`,
type: 'action',
label: '处理',
level: 'link',
...wareDetailDialog(
'parameters.wareId',
[
{
type: 'action',
label: '同意',
actionType: 'ajax',
close: true,
api: apiGet('${base}/check_order/operation/${checkOrderId}/APPLY'),
reload: 'check_order_list',
},
{
type: 'action',
label: '拒绝',
actionType: 'ajax',
close: true,
api: apiGet('${base}/check_order/operation/${checkOrderId}/REJECT'),
reload: 'check_order_list',
},
],
),
},
{
visibleOn: `\${type === 'MARKET' && state !== NORMAL}`,
type: 'action',
label: '查看',
level: 'link',
...wareDetailDialog('parameters.wareId'),
},
]),
],
},

View File

@@ -1,16 +1,132 @@
import {wareAddDialog} from "../../components/ware/dialog-ware.js";
import {wareAddDialog, wareDetailDialog, wareEditeDialog} from "../../components/ware/dialog-ware.js";
import {
apiGet,
crudCommonOptions,
mappingField,
operationField,
permissionStateMapping,
timeField
} from "../../components/constants.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() {
return {
title: '数据市场',
icon: 'fa fa-store',
reload: true,
body: [
{
type: 'action',
label: '',
icon: 'fa fa-plus',
...wareAddDialog()
},
type: 'tabs',
tabs: [
{
title: '公开数据',
body: {
type: 'crud',
api: apiGet('${base}/ware/list_public'),
...crudCommonOptions(),
headerToolbar: [
'reload',
],
data: {
public: true
},
...listColumns(),
}
},
{
title: '我的数据',
body: {
type: 'crud',
api: apiGet('${base}/ware/list'),
...crudCommonOptions(),
headerToolbar: [
'reload',
{
type: 'action',
label: '',
icon: 'fa fa-plus',
...wareAddDialog()
},
],
...listColumns(),
}
},
]
}
]
}
}