diff --git a/gringotts-frontend/components/permission/dialog-permission.js b/gringotts-frontend/components/permission/dialog-permission.js index 9485b26..82a5b41 100644 --- a/gringotts-frontend/components/permission/dialog-permission.js +++ b/gringotts-frontend/components/permission/dialog-permission.js @@ -1,9 +1,30 @@ import './dialog-permission.css' -import {apiPost, horizontalFormOptions} from "../constants.js"; +import {apiGet, apiPost, horizontalFormOptions, inputFileFormItemCommonOptions, size100MB} from "../constants.js"; +import {resourceList} from "../../pages/index/tab-data.js"; + +function inputFileFormItemUpdateFieldOptions(target) { + let value = {} + value[target] = '${event.data.value}' + return { + onEvent: { + success: { + actions: [ + // { + // actionType: 'setValue', + // componentId: 'permission_form', + // args: { + // value: value + // } + // } + ] + } + } + } +} function detailForm() { return { - id: 'resource_data_form', + id: 'permission_form', type: 'form', ...horizontalFormOptions(), horizontal: { @@ -14,10 +35,33 @@ function detailForm() { type: 'hidden', name: 'id', }, + { + type: 'picker', + name: 'targetId', + label: '数据资源', + required: true, + multiple: false, + size: 'lg', + valueField: 'id', + labelField: 'name', + source: apiGet('${base}/data_resource/list'), + pickerSchema: { + ...resourceList(), + } + }, { type: 'textarea', label: '确权说明', name: 'description', + }, + { + type: 'input-file', + label: '相关材料', + name: 'evidenceIds', + multiple: true, + required: true, + extractValue: true, + ...inputFileFormItemCommonOptions(undefined, size100MB), } ] } @@ -51,3 +95,23 @@ export function permissionAddDialog() { } } } + +export function permissionDetailDialog() { + return { + actionType: 'dialog', + dialog: { + title: '新增确权申请', + size: 'md', + actions: [], + body: { + debug: true, + ...detailForm(), + initApi: apiGet('${base}/confirmation/detail/${id}'), + static: true, + data: { + detail: true, + }, + } + } + } +} diff --git a/gringotts-frontend/pages/index/tab-data.js b/gringotts-frontend/pages/index/tab-data.js index 7ab8711..f5f7acc 100644 --- a/gringotts-frontend/pages/index/tab-data.js +++ b/gringotts-frontend/pages/index/tab-data.js @@ -5,57 +5,57 @@ import { } from "../../components/resource/dialog-resource.js"; import {apiGet, crudCommonOptions, userOnly} from "../../components/constants.js"; -export function tabData() { +export function resourceList() { return { - visibleOn: userOnly, - title: '数据资源', - icon: 'fa fa-database', - body: [ + type: 'crud', + api: apiGet('${base}/data_resource/list'), + ...crudCommonOptions(), + headerToolbar: [ + 'reload', { - type: 'crud', - api: { - ...apiGet('${base}/data_resource/list') - }, - ...crudCommonOptions(), - headerToolbar: [ - 'reload', + type: 'action', + label: '', + icon: 'fa fa-plus', + ...resourceAddDialog() + }, + ], + columns: [ + { + label: '名称', + name: 'name', + width: 200, + }, + { + label: '描述', + name: 'description', + }, + { + label: '创建时间', + width: 150, + align: 'center', + type: 'tpl', + tpl: "${IF(createdTime, DATETOSTR(createdTime), '-')}" + }, + { + label: '操作', + width: 100, + type: 'operation', + fixed: 'right', + className: 'nowrap', + buttons: [ { type: 'action', - label: '', - icon: 'fa fa-plus', - ...resourceAddDialog() - }, - ], - columns: [ - { - label: '名称', - name: 'name', - width: 200, + label: '详情', + level: 'link', + ...resourceDetailDialog(), }, { - label: '描述', - name: 'description', - }, - { - label: '创建时间', - width: 150, - align: 'center', - type: 'tpl', - tpl: "${IF(createdTime, DATETOSTR(createdTime), '-')}" - }, - { - label: '操作', - width: 100, - type: 'operation', - fixed: 'right', - className: 'nowrap', + type: 'dropdown-button', + level: 'link', + icon: 'fa fa-ellipsis-h', + hideCaret: true, + trigger: 'hover', buttons: [ - { - type: 'action', - label: '查看', - level: 'link', - ...resourceDetailDialog(), - }, { type: 'action', label: '编辑', @@ -63,31 +63,26 @@ export function tabData() { ...resourceEditeDialog(), }, { - type: 'dropdown-button', - level: 'link', - icon: 'fa fa-ellipsis-h', - hideCaret: true, - trigger: 'hover', - buttons: [ - { - type: 'action', - label: '申请确权', - level: 'link', - }, - { - type: 'action', - label: '删除', - confirmTitle: '确认删除', - confirmText: '确认删除名称为「${name}」的数据资源吗?', - actionType: 'ajax', - api: apiGet('${base}/data_resource/remove/${id}') - }, - ] + type: 'action', + label: '删除', + confirmTitle: '确认删除', + confirmText: '确认删除名称为「${name}」的数据资源吗?', + actionType: 'ajax', + api: apiGet('${base}/data_resource/remove/${id}') }, ] }, ] - } + }, ] } +} + +export function tabData() { + return { + visibleOn: userOnly, + title: '数据资源', + icon: 'fa fa-database', + body: resourceList(), + } } \ No newline at end of file diff --git a/gringotts-frontend/pages/index/tab-permissions.js b/gringotts-frontend/pages/index/tab-permissions.js index 53627ea..a47348f 100644 --- a/gringotts-frontend/pages/index/tab-permissions.js +++ b/gringotts-frontend/pages/index/tab-permissions.js @@ -1,5 +1,5 @@ import {apiGet, crudCommonOptions, providerOnly, userOnly} from "../../components/constants.js"; -import {permissionAddDialog} from "../../components/permission/dialog-permission.js"; +import {permissionAddDialog, permissionDetailDialog} from "../../components/permission/dialog-permission.js"; export function tabPermissions() { return { @@ -55,6 +55,7 @@ export function tabPermissions() { type: 'action', label: '查看', level: 'link', + ...permissionDetailDialog(), }, { type: 'action', diff --git a/gringotts-web/src/main/java/com/eshore/gringotts/web/domain/base/entity/FileInfo.java b/gringotts-web/src/main/java/com/eshore/gringotts/web/domain/base/entity/FileInfo.java new file mode 100644 index 0000000..956e700 --- /dev/null +++ b/gringotts-web/src/main/java/com/eshore/gringotts/web/domain/base/entity/FileInfo.java @@ -0,0 +1,16 @@ +package com.eshore.gringotts.web.domain.base.entity; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +@AllArgsConstructor +public final class FileInfo { + private Long id; + private String name; + private String filename; + private Long value; + private String state; +} diff --git a/gringotts-web/src/main/java/com/eshore/gringotts/web/domain/confirmation/controller/ConfirmationController.java b/gringotts-web/src/main/java/com/eshore/gringotts/web/domain/confirmation/controller/ConfirmationController.java index a6351a0..f9cf3f9 100644 --- a/gringotts-web/src/main/java/com/eshore/gringotts/web/domain/confirmation/controller/ConfirmationController.java +++ b/gringotts-web/src/main/java/com/eshore/gringotts/web/domain/confirmation/controller/ConfirmationController.java @@ -1,12 +1,13 @@ package com.eshore.gringotts.web.domain.confirmation.controller; import com.eshore.gringotts.web.domain.base.controller.SimpleController; +import com.eshore.gringotts.web.domain.base.entity.FileInfo; +import com.eshore.gringotts.web.domain.base.entity.SimpleDetailItem; import com.eshore.gringotts.web.domain.base.entity.SimpleListItem; import com.eshore.gringotts.web.domain.base.entity.SimpleSaveItem; import com.eshore.gringotts.web.domain.confirmation.entity.Confirmation; import com.eshore.gringotts.web.domain.confirmation.service.ConfirmationService; import com.eshore.gringotts.web.domain.resource.service.DataResourceService; -import com.eshore.gringotts.web.domain.upload.entity.DataFile; import com.eshore.gringotts.web.domain.upload.service.DataFileService; import lombok.Data; import lombok.EqualsAndHashCode; @@ -76,11 +77,27 @@ public class ConfirmationController extends SimpleController { + private Long targetId; + private String targetName; + private String description; + private ImmutableSet evidenceIds; + public DetailItem(Confirmation confirmation) { this.setId(confirmation.getId()); + this.setTargetId(confirmation.getTarget().getId()); + this.setTargetName(confirmation.getTarget().getName()); this.setDescription(confirmation.getDescription()); - this.setEvidenceIds(Sets.immutable.ofAll(confirmation.getEvidences()).collect(DataFile::getId)); + this.setEvidenceIds( + Sets.immutable.ofAll(confirmation.getEvidences()) + .collect(file -> new FileInfo( + file.getId(), + file.getFilename(), + file.getFilename(), + file.getId(), + "uploaded" + )) + ); } } } diff --git a/gringotts-web/src/main/resources/application.yml b/gringotts-web/src/main/resources/application.yml index 1e6aef9..bd17b7d 100644 --- a/gringotts-web/src/main/resources/application.yml +++ b/gringotts-web/src/main/resources/application.yml @@ -34,4 +34,4 @@ logging: EventSubscribeImp: error gringotts: upload: - upload-path: /Users/lanyuanxiaoyao/Project/IdeaProjects/gringotts/gringotts-web/target/upload \ No newline at end of file + upload-path: C:\Users\lanyuanxiaoyao\Projects\gringotts\gringotts-web\target \ No newline at end of file