feat(web): 增加数据资源确权状态显示
This commit is contained in:
@@ -175,6 +175,7 @@ export const userStateMapping = [
|
||||
]
|
||||
|
||||
export const confirmationStateMapping = [
|
||||
mappingItem('未确权', 'NONE'),
|
||||
mappingItem('草稿', 'DRAFT', 'bg-primary'),
|
||||
mappingItem('审查中', 'CHECKING', 'bg-warning'),
|
||||
mappingItem('通过', 'NORMAL', 'bg-success'),
|
||||
@@ -199,6 +200,21 @@ export function apiPost(url) {
|
||||
return api('post', url)
|
||||
}
|
||||
|
||||
export function arrayInCheck(array, field) {
|
||||
return `\${ARRAYINCLUDES(['${array.join("','")}'], ${field})}`
|
||||
}
|
||||
|
||||
export function arrayOutCheck(array, field) {
|
||||
return `\${!ARRAYINCLUDES(['${array.join("','")}'], ${field})}`
|
||||
}
|
||||
|
||||
export const confirmationState = {
|
||||
none: 'NONE',
|
||||
draft: 'DRAFT',
|
||||
checking: 'CHECKING',
|
||||
normal: 'NORMAL',
|
||||
}
|
||||
|
||||
export function roleCheck(roles) {
|
||||
return `\${ARRAYINCLUDES(['${roles.join("','")}'], role)}`
|
||||
}
|
||||
|
||||
@@ -59,8 +59,8 @@ useAmis(information => {
|
||||
tabs: [
|
||||
// tabOverview(),
|
||||
// tabMarket(),
|
||||
tabCheck(),
|
||||
tabData(),
|
||||
tabCheck(),
|
||||
tabPermissions(),
|
||||
tabUser(),
|
||||
tabSettings(),
|
||||
|
||||
@@ -3,7 +3,16 @@ import {
|
||||
resourceDetailDialog,
|
||||
resourceEditeDialog
|
||||
} from "../../components/resource/dialog-resource.js";
|
||||
import {apiGet, crudCommonOptions, userOnly} from "../../components/constants.js";
|
||||
import {
|
||||
apiGet,
|
||||
arrayInCheck,
|
||||
arrayOutCheck,
|
||||
confirmationState,
|
||||
confirmationStateMapping,
|
||||
crudCommonOptions,
|
||||
mappingField,
|
||||
userOnly
|
||||
} from "../../components/constants.js";
|
||||
|
||||
export function resourceList() {
|
||||
return {
|
||||
@@ -23,12 +32,18 @@ export function resourceList() {
|
||||
{
|
||||
label: '名称',
|
||||
name: 'name',
|
||||
width: 200,
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
label: '描述',
|
||||
name: 'description',
|
||||
},
|
||||
{
|
||||
label: '确权状态',
|
||||
width: 80,
|
||||
align: 'center',
|
||||
...mappingField('confirmationState', confirmationStateMapping)
|
||||
},
|
||||
{
|
||||
label: '创建时间',
|
||||
width: 150,
|
||||
@@ -57,14 +72,18 @@ export function resourceList() {
|
||||
trigger: 'hover',
|
||||
buttons: [
|
||||
{
|
||||
disabledOn: '${confirmationId}',
|
||||
disabledOn: arrayOutCheck([confirmationState.none, confirmationState.draft], 'confirmationState'),
|
||||
disabledTip: '审查或确权成功后无法编辑',
|
||||
tooltipPlacement: 'top',
|
||||
type: 'action',
|
||||
label: '编辑',
|
||||
level: 'link',
|
||||
...resourceEditeDialog(),
|
||||
},
|
||||
{
|
||||
disabledOn: '${confirmationId}',
|
||||
disabledOn: arrayInCheck([confirmationState.checking], 'confirmationState'),
|
||||
disabledTip: '审查中无法删除',
|
||||
tooltipPlacement: 'bottom',
|
||||
type: 'action',
|
||||
label: "删除",
|
||||
confirmTitle: '确认删除',
|
||||
|
||||
@@ -64,6 +64,10 @@ public class Confirmation extends SimpleEntity {
|
||||
private State state = State.DRAFT;
|
||||
|
||||
public enum State {
|
||||
/**
|
||||
* 无确权
|
||||
*/
|
||||
NONE,
|
||||
/**
|
||||
* 草稿
|
||||
*/
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.eshore.gringotts.web.domain.base.controller.SimpleControllerSupport;
|
||||
import com.eshore.gringotts.web.domain.base.entity.FileInfo;
|
||||
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.resource.entity.DataResource;
|
||||
import com.eshore.gringotts.web.domain.resource.entity.format.CsvResourceFormat;
|
||||
import com.eshore.gringotts.web.domain.resource.entity.format.JsonLineResourceFormat;
|
||||
@@ -78,6 +79,9 @@ public class DataResourceController extends SimpleControllerSupport<DataResource
|
||||
item.setFormat(dataResource.getFormat().getFormatType().name());
|
||||
if (ObjectUtil.isNotNull(dataResource.getConfirmation())) {
|
||||
item.setConfirmationId(dataResource.getConfirmation().getId());
|
||||
item.setConfirmationState(dataResource.getConfirmation().getState());
|
||||
} else {
|
||||
item.setConfirmationState(Confirmation.State.NONE);
|
||||
}
|
||||
item.setCreatedUser(dataResource.getCreatedUser().getUsername());
|
||||
item.setCreatedTime(dataResource.getCreatedTime());
|
||||
@@ -250,6 +254,7 @@ public class DataResourceController extends SimpleControllerSupport<DataResource
|
||||
private String type;
|
||||
private String format;
|
||||
private Long confirmationId;
|
||||
private Confirmation.State confirmationState;
|
||||
private String createdUser;
|
||||
private LocalDateTime createdTime;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user