feat(web): 优化数据资源和数据文件查询逻辑
- 新增 listPredicate 方法统一处理查询逻辑- 优化了 DataResourceService 和 DataFileService 的查询性能 - 重构了 EntityHelper 类,增加了 checkNeededEntityPrediction 方法 - 调整了 AuthenticationService、CheckOrderService 和 ConfirmationService 的查询逻辑 - 更新了前端 dialog-permission.js 组件
This commit is contained in:
@@ -16,6 +16,16 @@ import {resourceDetailDialog} from "../resource/dialog-resource.js";
|
||||
const CONFIRMATION_TYPE = 'confirmation'
|
||||
const AUTHENTICATION_TYPE = 'authentication'
|
||||
|
||||
const CONFIRMATION = {
|
||||
type: 'confirmation',
|
||||
pickerApi: apiGet('${base}/data_resource/list_no_confirmation')
|
||||
}
|
||||
|
||||
const AUTHENTICATION = {
|
||||
type: 'authentication',
|
||||
pickerApi: apiGet('${base}/data_resource/list_no_authentication')
|
||||
}
|
||||
|
||||
function detailForm(pickerApi = apiGet('${base}/data_resource/list'), showCreatedUserAndModifiedUser = false) {
|
||||
return {
|
||||
debug: information.debug,
|
||||
@@ -98,16 +108,16 @@ function detailForm(pickerApi = apiGet('${base}/data_resource/list'), showCreate
|
||||
}
|
||||
|
||||
export function confirmationAddDialog() {
|
||||
return permissionAddDialog(CONFIRMATION_TYPE)
|
||||
return permissionAddDialog(CONFIRMATION)
|
||||
}
|
||||
|
||||
export function authenticationAddDialog() {
|
||||
return permissionAddDialog(AUTHENTICATION_TYPE)
|
||||
return permissionAddDialog(AUTHENTICATION)
|
||||
}
|
||||
|
||||
function permissionAddDialog(type) {
|
||||
function permissionAddDialog(config) {
|
||||
let data = {add: true}
|
||||
data[type] = true
|
||||
data[config.type] = true
|
||||
return {
|
||||
actionType: 'dialog',
|
||||
dialog: {
|
||||
@@ -125,8 +135,8 @@ function permissionAddDialog(type) {
|
||||
}
|
||||
],
|
||||
body: {
|
||||
...detailForm(generateApi(type)),
|
||||
api: apiPost(`\${base}/${type}/save`),
|
||||
...detailForm(config.pickerApi),
|
||||
api: apiPost(`\${base}/${config.type}/save`),
|
||||
data: data,
|
||||
}
|
||||
}
|
||||
@@ -134,16 +144,16 @@ function permissionAddDialog(type) {
|
||||
}
|
||||
|
||||
export function confirmationDetailDialog(field = 'id', actions = []) {
|
||||
return permissionDetailDialog(CONFIRMATION_TYPE, field, actions)
|
||||
return permissionDetailDialog(CONFIRMATION, field, actions)
|
||||
}
|
||||
|
||||
export function authenticationDetailDialog(field = 'id', actions = []) {
|
||||
return permissionDetailDialog(AUTHENTICATION_TYPE, field, actions)
|
||||
return permissionDetailDialog(AUTHENTICATION, field, actions)
|
||||
}
|
||||
|
||||
function permissionDetailDialog(type, field = 'id', actions = []) {
|
||||
function permissionDetailDialog(config, field = 'id', actions = []) {
|
||||
let data = {detail: true}
|
||||
data[type] = true
|
||||
data[config.type] = true
|
||||
return {
|
||||
actionType: 'dialog',
|
||||
dialog: {
|
||||
@@ -151,8 +161,8 @@ function permissionDetailDialog(type, field = 'id', actions = []) {
|
||||
size: 'md',
|
||||
actions: actions,
|
||||
body: {
|
||||
...detailForm(generateApi(type), true),
|
||||
initApi: apiGet(`\${base}/${type}/detail/\${${field}}`),
|
||||
...detailForm(config.pickerApi, true),
|
||||
initApi: apiGet(`\${base}/${config.type}/detail/\${${field}}`),
|
||||
static: true,
|
||||
data: data,
|
||||
}
|
||||
@@ -161,16 +171,16 @@ function permissionDetailDialog(type, field = 'id', actions = []) {
|
||||
}
|
||||
|
||||
export function confirmationEditeDialog(field = 'id') {
|
||||
return permissionEditeDialog(CONFIRMATION_TYPE, field)
|
||||
return permissionEditeDialog(CONFIRMATION, field)
|
||||
}
|
||||
|
||||
export function authenticationEditeDialog(field = 'id') {
|
||||
return permissionEditeDialog(AUTHENTICATION_TYPE, field)
|
||||
return permissionEditeDialog(AUTHENTICATION, field)
|
||||
}
|
||||
|
||||
function permissionEditeDialog(type, field = 'id') {
|
||||
function permissionEditeDialog(config, field = 'id') {
|
||||
let data = {edit: true}
|
||||
data[type] = true
|
||||
data[config.type] = true
|
||||
return {
|
||||
actionType: 'dialog',
|
||||
dialog: {
|
||||
@@ -188,20 +198,11 @@ function permissionEditeDialog(type, field = 'id') {
|
||||
}
|
||||
],
|
||||
body: {
|
||||
...detailForm(generateApi(type)),
|
||||
api: apiPost(`\${base}/${type}/save`),
|
||||
initApi: apiGet(`\${base}/${type}/detail/\${${field}}`),
|
||||
...detailForm(config.pickerApi),
|
||||
api: apiPost(`\${base}/${config.type}/save`),
|
||||
initApi: apiGet(`\${base}/${config.type}/detail/\${${field}}`),
|
||||
data: data,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function generateApi(type) {
|
||||
switch (type) {
|
||||
case AUTHENTICATION_TYPE:
|
||||
return apiGet('${base}/data_resource/list_no_authentication')
|
||||
case CONFIRMATION_TYPE:
|
||||
return apiGet('${base}/data_resource/list_no_confirmation')
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user