181 changed files with 22812 additions and 190547 deletions
@ -1,10 +0,0 @@ |
|||||
package io.sc.engine.rule.core.enums; |
|
||||
|
|
||||
/** |
|
||||
* 定性指标补录附件类型 |
|
||||
*/ |
|
||||
public enum QualitativeAdditionAttachmentMode { |
|
||||
NONE, // 无
|
|
||||
OPTION, // 可选
|
|
||||
FORCE; // 必须
|
|
||||
} |
|
@ -1,10 +0,0 @@ |
|||||
package io.sc.engine.rule.core.enums; |
|
||||
|
|
||||
/** |
|
||||
* 定性指标补录模式 |
|
||||
*/ |
|
||||
public enum QualitativeAdditionMode { |
|
||||
NONE, // 无
|
|
||||
OPTION, // 可选
|
|
||||
FORCE; // 必须
|
|
||||
} |
|
@ -0,0 +1,115 @@ |
|||||
|
package io.sc.engine.rule.core.po.model; |
||||
|
|
||||
|
import io.sc.engine.rule.core.enums.QualitativeAdditionComponentType; |
||||
|
|
||||
|
public class ParameterInOptionAddtion { |
||||
|
protected String id; |
||||
|
protected String code; |
||||
|
protected String name; |
||||
|
protected String description; |
||||
|
protected QualitativeAdditionComponentType componentType; |
||||
|
protected String condition; |
||||
|
protected Boolean enable =true; |
||||
|
protected Integer order; |
||||
|
|
||||
|
protected Integer rows; |
||||
|
protected String prompt; |
||||
|
protected String attachmentExtendNames; |
||||
|
protected Integer attachmentMaxCount; |
||||
|
|
||||
|
public String getId() { |
||||
|
return id; |
||||
|
} |
||||
|
|
||||
|
public void setId(String id) { |
||||
|
this.id = id; |
||||
|
} |
||||
|
|
||||
|
public String getCode() { |
||||
|
return code; |
||||
|
} |
||||
|
|
||||
|
public void setCode(String code) { |
||||
|
this.code = code; |
||||
|
} |
||||
|
|
||||
|
public String getName() { |
||||
|
return name; |
||||
|
} |
||||
|
|
||||
|
public void setName(String name) { |
||||
|
this.name = name; |
||||
|
} |
||||
|
|
||||
|
public String getDescription() { |
||||
|
return description; |
||||
|
} |
||||
|
|
||||
|
public void setDescription(String description) { |
||||
|
this.description = description; |
||||
|
} |
||||
|
|
||||
|
public QualitativeAdditionComponentType getComponentType() { |
||||
|
return componentType; |
||||
|
} |
||||
|
|
||||
|
public void setComponentType(QualitativeAdditionComponentType componentType) { |
||||
|
this.componentType = componentType; |
||||
|
} |
||||
|
|
||||
|
public String getCondition() { |
||||
|
return condition; |
||||
|
} |
||||
|
|
||||
|
public void setCondition(String condition) { |
||||
|
this.condition = condition; |
||||
|
} |
||||
|
|
||||
|
public Boolean getEnable() { |
||||
|
return enable; |
||||
|
} |
||||
|
|
||||
|
public void setEnable(Boolean enable) { |
||||
|
this.enable = enable; |
||||
|
} |
||||
|
|
||||
|
public Integer getOrder() { |
||||
|
return order; |
||||
|
} |
||||
|
|
||||
|
public void setOrder(Integer order) { |
||||
|
this.order = order; |
||||
|
} |
||||
|
|
||||
|
public Integer getRows() { |
||||
|
return rows; |
||||
|
} |
||||
|
|
||||
|
public void setRows(Integer rows) { |
||||
|
this.rows = rows; |
||||
|
} |
||||
|
|
||||
|
public String getPrompt() { |
||||
|
return prompt; |
||||
|
} |
||||
|
|
||||
|
public void setPrompt(String prompt) { |
||||
|
this.prompt = prompt; |
||||
|
} |
||||
|
|
||||
|
public String getAttachmentExtendNames() { |
||||
|
return attachmentExtendNames; |
||||
|
} |
||||
|
|
||||
|
public void setAttachmentExtendNames(String attachmentExtendNames) { |
||||
|
this.attachmentExtendNames = attachmentExtendNames; |
||||
|
} |
||||
|
|
||||
|
public Integer getAttachmentMaxCount() { |
||||
|
return attachmentMaxCount; |
||||
|
} |
||||
|
|
||||
|
public void setAttachmentMaxCount(Integer attachmentMaxCount) { |
||||
|
this.attachmentMaxCount = attachmentMaxCount; |
||||
|
} |
||||
|
} |
@ -0,0 +1,251 @@ |
|||||
|
<template> |
||||
|
<w-grid |
||||
|
ref="gridRef" |
||||
|
dense-body |
||||
|
class="px-1" |
||||
|
hide-bottom |
||||
|
:config-button="false" |
||||
|
dnd-mode="server" |
||||
|
selection="multiple" |
||||
|
:checkbox-selection="true" |
||||
|
db-click-operation="edit" |
||||
|
:tree="false" |
||||
|
:fetch-data-url="Environment.apiContextPath('/api/re/model/parameter/addition/findByParameterId?parameterId=' + parameter.id)" |
||||
|
:data-url="Environment.apiContextPath('/api/re/model/parameter/addition')" |
||||
|
:pageable="false" |
||||
|
:sort-by="['order']" |
||||
|
:toolbar-configure="{ noIcon: false }" |
||||
|
:toolbar-actions="[ |
||||
|
'refresh', |
||||
|
'separator', |
||||
|
{ |
||||
|
extend: 'add', |
||||
|
enableIf: (arg) => { |
||||
|
return !readOnly; |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'clone', |
||||
|
enableIf: (arg) => { |
||||
|
return !readOnly && arg.selected; |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'edit', |
||||
|
enableIf: (arg) => { |
||||
|
return !readOnly && arg.selected; |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'remove', |
||||
|
enableIf: (arg) => { |
||||
|
return !readOnly && arg.selected; |
||||
|
}, |
||||
|
}, |
||||
|
'separator', |
||||
|
'view', |
||||
|
'separator', |
||||
|
'export', |
||||
|
]" |
||||
|
:columns="[ |
||||
|
{ |
||||
|
width: 70, |
||||
|
name: 'enable', |
||||
|
label: $t('status'), |
||||
|
align: 'center', |
||||
|
format: Formater.enableTag(), |
||||
|
}, |
||||
|
{ |
||||
|
width: 120, |
||||
|
name: 'code', |
||||
|
label: $t('re.addition.grid.entity.code'), |
||||
|
}, |
||||
|
{ |
||||
|
width: 200, |
||||
|
name: 'name', |
||||
|
label: $t('re.addition.grid.entity.name'), |
||||
|
}, |
||||
|
{ |
||||
|
width: 200, |
||||
|
name: 'description', |
||||
|
label: $t('re.addition.grid.entity.description'), |
||||
|
}, |
||||
|
{ |
||||
|
width: 100, |
||||
|
name: 'componentType', |
||||
|
label: $t('re.addition.grid.entity.componentType'), |
||||
|
format: (value: any, row: any) => { |
||||
|
let text = $t('io.sc.engine.rule.core.enums.QualitativeAdditionComponentType.' + value); |
||||
|
if ('TEXTS' === value) { |
||||
|
text += '(' + row.rows + ')'; |
||||
|
} else if ('ATTACHMENT' === value) { |
||||
|
text += '(' + row.attachmentMaxCount + ')'; |
||||
|
} |
||||
|
return text; |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
width: 200, |
||||
|
name: 'condition', |
||||
|
label: $t('re.addition.grid.entity.condition'), |
||||
|
}, |
||||
|
{ |
||||
|
width: 300, |
||||
|
name: 'prompt', |
||||
|
label: $t('re.addition.grid.entity.prompt'), |
||||
|
}, |
||||
|
]" |
||||
|
:editor="{ |
||||
|
dialog: { |
||||
|
width: '600px', |
||||
|
}, |
||||
|
form: { |
||||
|
colsNum: 1, |
||||
|
fields: [ |
||||
|
{ name: 'parameter', label: 'parameter', type: 'w-text', defaultValue: parameter.id, showIf: false }, |
||||
|
{ |
||||
|
name: 'code', |
||||
|
label: $t('re.addition.grid.entity.code'), |
||||
|
type: 'w-text', |
||||
|
requiredIf: true, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'name', |
||||
|
label: $t('re.addition.grid.entity.name'), |
||||
|
type: 'w-text', |
||||
|
requiredIf: true, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'description', |
||||
|
label: $t('re.addition.grid.entity.description'), |
||||
|
type: 'w-textarea', |
||||
|
rows: 3, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'condition', |
||||
|
label: $t('re.addition.grid.entity.condition'), |
||||
|
type: 'w-code-mirror', |
||||
|
lang: 'java', |
||||
|
rows: 4, |
||||
|
placeholder: true, |
||||
|
lineWrap: true, |
||||
|
lineBreak: false, |
||||
|
autoCompletion: autoCompletionManager.autoCompletion(), |
||||
|
userDefinedFunctions: userDefinedFunctionsManager.userDefinedFunctions(), |
||||
|
}, |
||||
|
{ |
||||
|
name: 'componentType', |
||||
|
label: $t('re.addition.grid.entity.componentType'), |
||||
|
type: 'w-select', |
||||
|
options: EngineEnums.QualitativeAdditionComponentType.options, |
||||
|
requiredIf: true, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'rows', |
||||
|
label: $t('re.addition.grid.entity.rows'), |
||||
|
type: 'w-integer', |
||||
|
defaultValue: 3, |
||||
|
showIf: (args: any) => { |
||||
|
return args.form.getFieldValue('componentType') === 'TEXTS'; |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'prompt', |
||||
|
label: $t('re.addition.grid.entity.prompt'), |
||||
|
type: 'w-textarea', |
||||
|
defaultValue: 3, |
||||
|
showIf: (args: any) => { |
||||
|
const type = args.form.getFieldValue('componentType'); |
||||
|
return type === 'TEXT' || type === 'TEXTS'; |
||||
|
}, |
||||
|
}, |
||||
|
|
||||
|
{ |
||||
|
name: 'attachmentExtendNames', |
||||
|
label: $t('re.addition.grid.entity.attachmentExtendNames'), |
||||
|
type: 'w-text', |
||||
|
defaultValue: '*.pdf', |
||||
|
showIf: (args: any) => { |
||||
|
const type = args.form.getFieldValue('componentType'); |
||||
|
return type === 'ATTACHMENT'; |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'attachmentMaxCount', |
||||
|
label: $t('re.addition.grid.entity.attachmentMaxCount'), |
||||
|
type: 'w-integer', |
||||
|
defaultValue: 1, |
||||
|
showIf: (args: any) => { |
||||
|
const type = args.form.getFieldValue('componentType'); |
||||
|
return type === 'ATTACHMENT'; |
||||
|
}, |
||||
|
}, |
||||
|
|
||||
|
{ name: 'enable', label: $t('enable'), type: 'w-checkbox', defaultValue: true }, |
||||
|
], |
||||
|
}, |
||||
|
}" |
||||
|
:viewer="{ |
||||
|
panel: { |
||||
|
columnNum: 1, |
||||
|
fields: [ |
||||
|
{ name: 'id', label: $t('id') }, |
||||
|
{ name: 'parameter', label: $t('parameter') }, |
||||
|
{ name: 'code', label: $t('re.addition.grid.entity.code') }, |
||||
|
{ name: 'name', label: $t('re.addition.grid.entity.name') }, |
||||
|
{ name: 'description', label: $t('re.addition.grid.entity.description') }, |
||||
|
{ name: 'componentType', label: $t('re.addition.grid.entity.component') }, |
||||
|
{ name: 'condition', label: $t('re.addition.grid.entity.condition') }, |
||||
|
{ name: 'enable', label: $t('isEnable') }, |
||||
|
{ name: 'order', label: $t('order') }, |
||||
|
|
||||
|
{ name: 'rows', label: $t('re.addition.grid.entity.rows') }, |
||||
|
{ name: 'prompt', label: $t('re.addition.grid.entity.prompt') }, |
||||
|
{ name: 'attachmentExtendNames', label: $t('re.addition.grid.entity.attachmentExtendNames') }, |
||||
|
{ name: 'attachmentMaxCount', label: $t('re.addition.grid.entity.attachmentMaxCount') }, |
||||
|
...CorporationAuditorEntityManager.getViewerFields(), |
||||
|
], |
||||
|
}, |
||||
|
}" |
||||
|
></w-grid> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
import 'tailwindcss/utilities.css'; |
||||
|
import { ref, onMounted } from 'vue'; |
||||
|
import { Environment, Formater, CorporationAuditorEntityManager } from 'platform-core'; |
||||
|
import { EngineEnums } from '@/views/shared/enums/EngineEnums'; |
||||
|
import { AutoCompletionManager } from '@/views/shared/AutoCompletionManager'; |
||||
|
import { UserDefinedFunctionsManager } from '@/views/shared/UserDefinedFunctionsManager'; |
||||
|
|
||||
|
const props = defineProps({ |
||||
|
fetchDataUrl: { type: String, default: '' }, |
||||
|
dataUrl: { type: String, default: '' }, |
||||
|
parameter: { type: Object, default: undefined }, |
||||
|
readOnly: { type: Boolean, default: false }, |
||||
|
}); |
||||
|
|
||||
|
const emit = defineEmits<{ |
||||
|
(e: 'rowClick', evt: Event, row: any, index: number): void; |
||||
|
(e: 'beforeRequestData', requestParams: URLSearchParams | any, callback: any): void; |
||||
|
}>(); |
||||
|
|
||||
|
const gridRef = ref(); |
||||
|
const autoCompletionManager = new AutoCompletionManager(); |
||||
|
const userDefinedFunctionsManager = new UserDefinedFunctionsManager(); |
||||
|
|
||||
|
const refresh = () => { |
||||
|
gridRef.value.refresh(); |
||||
|
}; |
||||
|
|
||||
|
onMounted(() => { |
||||
|
gridRef.value.refresh(); |
||||
|
}); |
||||
|
|
||||
|
defineExpose({ |
||||
|
refresh, |
||||
|
}); |
||||
|
|
||||
|
await EngineEnums.init(); |
||||
|
autoCompletionManager.load(Environment.apiContextPath('/api/re/common/parameterAndValueType/findByParameterId/' + props.parameter.id)); |
||||
|
userDefinedFunctionsManager.load(); |
||||
|
</script> |
@ -0,0 +1,280 @@ |
|||||
|
<template> |
||||
|
<div class="px-2" style="height: 100%"> |
||||
|
<w-grid |
||||
|
v-if="isListOrUserDefinedJavaClass" |
||||
|
ref="gridRef" |
||||
|
:title="$t('defaultValue')" |
||||
|
:local-mode="true" |
||||
|
db-click-operation="edit" |
||||
|
:auto-fetch-data="false" |
||||
|
:dense-body="true" |
||||
|
dnd-mode="local" |
||||
|
:pageable="false" |
||||
|
:config-button="false" |
||||
|
:toolbar-configure="{ noIcon: false }" |
||||
|
:toolbar-actions="gridToolbarActionsRef" |
||||
|
:columns="gridColumnsRef" |
||||
|
:rows="gridRowsRef" |
||||
|
:editor="{ |
||||
|
dialog: { |
||||
|
width: '600px', |
||||
|
}, |
||||
|
form: { |
||||
|
colsNum: 1, |
||||
|
fields: gridEditorFieldsRef, |
||||
|
}, |
||||
|
}" |
||||
|
@after-editor-data-submit="afterEditorDataSubmit" |
||||
|
@after-drag-and-drop="afterEditorDataSubmit" |
||||
|
> |
||||
|
</w-grid> |
||||
|
</div> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
import 'tailwindcss/utilities.css'; |
||||
|
import { ref, watch, computed, onMounted } from 'vue'; |
||||
|
import { axios, $t, Tools, Environment, Formater, CorporationAuditorEntityManager, Options } from 'platform-core'; |
||||
|
import { ValueTypeManager } from '@/views/shared/ValueTypeManager'; |
||||
|
import { ParameterAndValueTypeManager } from '@/views/shared/ParameterAndValueTypeManager'; |
||||
|
|
||||
|
const props = defineProps({ |
||||
|
fetchDataUrl: { type: String, default: '' }, |
||||
|
dataUrl: { type: String, default: '' }, |
||||
|
parameter: { type: Object, default: undefined }, |
||||
|
readOnly: { type: Boolean, default: false }, |
||||
|
}); |
||||
|
|
||||
|
const emit = defineEmits<{ |
||||
|
(e: 'updated', defaultValue: any): void; |
||||
|
}>(); |
||||
|
|
||||
|
const gridRef = ref(); |
||||
|
const gridToolbarActionsRef = ref<any[]>([]); |
||||
|
const gridColumnsRef = ref<any[]>([]); |
||||
|
const gridRowsRef = ref<any[]>([]); |
||||
|
const gridEditorFieldsRef = ref<any[]>([]); |
||||
|
let parameters = {}; |
||||
|
|
||||
|
const isListOrUserDefinedJavaClass = computed(() => { |
||||
|
return ( |
||||
|
(!ValueTypeManager.isBaseValueType(props.parameter.valueType) && !Tools.isUndefinedOrNull(props.parameter.valueTypeVersion)) || |
||||
|
props.parameter.valueTypeIsList |
||||
|
); |
||||
|
}); |
||||
|
|
||||
|
const refresh = async () => { |
||||
|
const valueType = props.parameter.valueType; |
||||
|
const valueTypeVersion = props.parameter.valueTypeVersion; |
||||
|
const valueTypeIsList = props.parameter.valueTypeIsList; |
||||
|
const defaultValue = props.parameter.defaultValue; |
||||
|
if (ValueTypeManager.isBaseValueType(valueType) && valueTypeIsList) { |
||||
|
await refreshBaseValueTypeList(valueType, defaultValue); |
||||
|
} else if (!ValueTypeManager.isBaseValueType(valueType) && !valueTypeIsList) { |
||||
|
await refreshUserDefinedJavaClass(valueType, valueTypeVersion, defaultValue); |
||||
|
} else if (!ValueTypeManager.isBaseValueType(valueType) && valueTypeIsList) { |
||||
|
await refreshUserDefinedJavaClassList(valueType, valueTypeVersion, defaultValue); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const refreshBaseValueTypeList = async (valueType: string, defaultValue: string) => { |
||||
|
// 表格列 |
||||
|
const columns: any[] = []; |
||||
|
if (ValueTypeManager.isBoolean(valueType)) { |
||||
|
columns.push({ name: 'value', label: $t('value'), sortable: false, format: Formater.trueFalse() }); |
||||
|
} else { |
||||
|
columns.push({ name: 'value', label: $t('value'), sortable: false }); |
||||
|
} |
||||
|
|
||||
|
// 表格行 |
||||
|
const rows: any[] = []; |
||||
|
const values = Tools.json2Object(defaultValue); |
||||
|
if (!Tools.isUndefinedOrNull(values)) { |
||||
|
for (const value of values) { |
||||
|
rows.push({ value: value }); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 表单字段 |
||||
|
const fields: any[] = []; |
||||
|
const field: any = createField(valueType); |
||||
|
field.name = 'value'; |
||||
|
field.label = $t('value'); |
||||
|
fields.push(field); |
||||
|
|
||||
|
gridToolbarActionsRef.value = ['add', 'clone', 'edit', 'remove']; |
||||
|
gridColumnsRef.value = columns; |
||||
|
gridEditorFieldsRef.value = fields; |
||||
|
gridRef.value?.setLocalData(rows); |
||||
|
}; |
||||
|
|
||||
|
const refreshUserDefinedJavaClass = async (valueType: string, valueTypeVersion: number, defaultValue: string) => { |
||||
|
const manager: ParameterAndValueTypeManager = new ParameterAndValueTypeManager(); |
||||
|
await manager.load(Environment.apiContextPath('/api/re/common/parameterAndValueType/findByDictionaryCodeAndVersion/' + valueType + '/' + valueTypeVersion)); |
||||
|
parameters = manager.getParameters(); |
||||
|
// 表格列 |
||||
|
const columns: any[] = [ |
||||
|
{ name: 'code', label: $t('code'), sortable: false, showIf: false }, |
||||
|
{ name: 'name', label: $t('name'), sortable: false, width: '30%' }, |
||||
|
{ |
||||
|
name: 'valueType', |
||||
|
label: $t('valueType'), |
||||
|
width: 200, |
||||
|
sortable: false, |
||||
|
format: (value: any, row: any) => { |
||||
|
return $t(value); |
||||
|
}, |
||||
|
}, |
||||
|
{ name: 'value', label: $t('value'), sortable: false }, |
||||
|
]; |
||||
|
// 表格行 |
||||
|
const rows: any[] = []; |
||||
|
const values = Tools.json2Object(defaultValue); |
||||
|
for (const key in parameters) { |
||||
|
rows.push({ |
||||
|
code: key, |
||||
|
name: parameters[key].name, |
||||
|
value: Tools.isUndefinedOrNull(values) ? undefined : values[key], |
||||
|
valueType: parameters[key].valueType, |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
// 表单字段 |
||||
|
const fields: any[] = []; |
||||
|
fields.push({ name: 'code', label: $t('code'), type: 'w-text', showIf: false }); |
||||
|
fields.push({ name: 'name', label: $t('name'), type: 'w-text', showIf: false }); |
||||
|
fields.push({ name: 'valueType', label: $t('valueType'), type: 'w-text', showIf: false }); |
||||
|
|
||||
|
// 排除重复的值类型 |
||||
|
const valueTypeMap = {}; |
||||
|
for (const key in parameters) { |
||||
|
const type = parameters[key].valueType; |
||||
|
valueTypeMap[type] = type; |
||||
|
} |
||||
|
for (const key in valueTypeMap) { |
||||
|
const field: any = createField(key); |
||||
|
field.name = 'value'; |
||||
|
field.label = $t('value'); |
||||
|
field.showIf = (args: any) => { |
||||
|
return args.form.getFieldValue('valueType') === key; |
||||
|
}; |
||||
|
fields.push(field); |
||||
|
} |
||||
|
gridToolbarActionsRef.value = ['edit']; |
||||
|
gridColumnsRef.value = columns; |
||||
|
gridEditorFieldsRef.value = fields; |
||||
|
gridRef.value?.setLocalData(rows); |
||||
|
}; |
||||
|
|
||||
|
const refreshUserDefinedJavaClassList = async (valueType: string, valueTypeVersion: number, defaultValue: string) => { |
||||
|
const manager: ParameterAndValueTypeManager = new ParameterAndValueTypeManager(); |
||||
|
await manager.load(Environment.apiContextPath('/api/re/common/parameterAndValueType/findByDictionaryCodeAndVersion/' + valueType + '/' + valueTypeVersion)); |
||||
|
parameters = manager.getParameters(); |
||||
|
|
||||
|
// 表格列 |
||||
|
const columns: any[] = []; |
||||
|
for (const key in parameters) { |
||||
|
columns.push({ |
||||
|
name: key, |
||||
|
label: parameters[key].name, |
||||
|
sortable: false, |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
// 表格行 |
||||
|
const rows: any[] = []; |
||||
|
const values = Tools.json2Object(defaultValue); |
||||
|
if (!Tools.isUndefinedOrNull(values)) { |
||||
|
for (const value of values) { |
||||
|
rows.push(value); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 表单字段 |
||||
|
const fields: any[] = []; |
||||
|
for (const key in parameters) { |
||||
|
const field: any = createField(parameters[key].valueType); |
||||
|
field.name = parameters[key].code; |
||||
|
field.label = parameters[key].name; |
||||
|
fields.push(field); |
||||
|
} |
||||
|
gridToolbarActionsRef.value = ['add', 'clone', 'edit', 'remove']; |
||||
|
gridColumnsRef.value = columns; |
||||
|
gridEditorFieldsRef.value = fields; |
||||
|
gridRef.value?.setLocalData(rows); |
||||
|
}; |
||||
|
|
||||
|
const createField = (valueType: string) => { |
||||
|
if (ValueTypeManager.isBoolean(valueType)) { |
||||
|
return { |
||||
|
type: 'w-select', |
||||
|
options: [ |
||||
|
{ label: $t('true'), value: true }, |
||||
|
{ label: $t('false'), value: false }, |
||||
|
], |
||||
|
}; |
||||
|
} else if (ValueTypeManager.isInteger(valueType)) { |
||||
|
return { |
||||
|
type: 'w-integer', |
||||
|
}; |
||||
|
} else if (ValueTypeManager.isDecimal(valueType)) { |
||||
|
return { |
||||
|
type: 'w-number', |
||||
|
}; |
||||
|
} else if (ValueTypeManager.isDate(valueType)) { |
||||
|
return { |
||||
|
type: 'w-date', |
||||
|
}; |
||||
|
} else if (ValueTypeManager.isString(valueType)) { |
||||
|
return { |
||||
|
type: 'w-textarea', |
||||
|
rows: 5, |
||||
|
}; |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const afterEditorDataSubmit = (args: any) => { |
||||
|
const rows = args.grid.getRows(); |
||||
|
let requestJson: string | null = ''; |
||||
|
if (ValueTypeManager.isBaseValueType(props.parameter.valueType) && props.parameter.valueTypeIsList) { |
||||
|
const values: any[] = []; |
||||
|
for (const row of rows) { |
||||
|
values.push(row.value); |
||||
|
} |
||||
|
requestJson = Tools.object2Json(values); |
||||
|
} else if (!ValueTypeManager.isBaseValueType(props.parameter.valueType) && !props.parameter.valueTypeIsList) { |
||||
|
const values = {}; |
||||
|
for (const row of rows) { |
||||
|
values[row.code] = row['value']; |
||||
|
} |
||||
|
requestJson = Tools.object2Json(values); |
||||
|
} else if (!ValueTypeManager.isBaseValueType(props.parameter.valueType) && props.parameter.valueTypeIsList) { |
||||
|
const values: any[] = []; |
||||
|
for (const row of rows) { |
||||
|
const value = {}; |
||||
|
for (const key in parameters) { |
||||
|
value[key] = row[key]; |
||||
|
} |
||||
|
values.push(value); |
||||
|
} |
||||
|
requestJson = Tools.object2Json(values); |
||||
|
} |
||||
|
axios.post(Environment.apiContextPath('/api/re/model/parameter/updateParameterDefaultValue/' + props.parameter.id), { value: requestJson }).then(() => { |
||||
|
emit('updated', requestJson); |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
watch( |
||||
|
() => props.parameter, |
||||
|
async () => { |
||||
|
refresh(); |
||||
|
}, |
||||
|
); |
||||
|
|
||||
|
onMounted(() => { |
||||
|
refresh(); |
||||
|
}); |
||||
|
|
||||
|
defineExpose({ |
||||
|
refresh, |
||||
|
}); |
||||
|
</script> |
@ -0,0 +1,179 @@ |
|||||
|
<template> |
||||
|
<div> |
||||
|
<template v-if="valueTypeIsList"> |
||||
|
<w-grid |
||||
|
v-if="isUserDefinedJavaClass" |
||||
|
ref="gridRef" |
||||
|
:title="attrs.label" |
||||
|
:height="200" |
||||
|
:local-mode="true" |
||||
|
db-click-operation="edit" |
||||
|
:auto-fetch-data="false" |
||||
|
:dense-body="true" |
||||
|
dnd-mode="local" |
||||
|
:pageable="false" |
||||
|
:config-button="false" |
||||
|
:toolbar-configure="{ noIcon: false }" |
||||
|
:toolbar-actions="gridToolbarActions" |
||||
|
:columns="gridColumns" |
||||
|
:rows="gridRows" |
||||
|
> |
||||
|
</w-grid> |
||||
|
</template> |
||||
|
<template v-else> |
||||
|
<w-select v-if="isBoolean" v-model="modelValue" :label="attrs.label + '(' + $t(valueType) + ')'" :options="Options.truefalse()"></w-select> |
||||
|
<w-integer v-if="isInteger" v-model="modelValue" :label="attrs.label + '(' + $t(valueType) + ')'"></w-integer> |
||||
|
<w-number v-if="isDecimal" v-model="modelValue" :label="attrs.label + '(' + $t(valueType) + ')'"></w-number> |
||||
|
<w-text v-if="isString" v-model="modelValue" :label="attrs.label + '(' + $t(valueType) + ')'"></w-text> |
||||
|
<w-date v-if="isDate" v-model="modelValue" :label="attrs.label + '(' + $t(valueType) + ')'"></w-date> |
||||
|
<w-grid |
||||
|
v-if="isUserDefinedJavaClass" |
||||
|
ref="gridRef" |
||||
|
:title="attrs.label" |
||||
|
:height="200" |
||||
|
:local-mode="true" |
||||
|
db-click-operation="edit" |
||||
|
:auto-fetch-data="false" |
||||
|
:dense-body="true" |
||||
|
dnd-mode="local" |
||||
|
:pageable="false" |
||||
|
:config-button="false" |
||||
|
:toolbar-configure="{ noIcon: false }" |
||||
|
:toolbar-actions="['edit']" |
||||
|
:columns="gridColumns" |
||||
|
:rows="gridRows" |
||||
|
> |
||||
|
</w-grid> |
||||
|
</template> |
||||
|
</div> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
import { ref, useAttrs, computed } from 'vue'; |
||||
|
import { $t, Environment, Formater, Options, Tools } from 'platform-core'; |
||||
|
import { ParameterAndValueTypeManager } from './ParameterAndValueTypeManager'; |
||||
|
|
||||
|
const attrs = useAttrs(); |
||||
|
const modelValue = defineModel<string | number | boolean>(); |
||||
|
const emit = defineEmits(['update:modelValue']); |
||||
|
|
||||
|
const VALUE_TYPES = { |
||||
|
'java.lang.Integer': 'java.lang.Integer', |
||||
|
'java.lang.Long': 'java.lang.Long', |
||||
|
'java.math.BigInteger': 'java.math.BigInteger', |
||||
|
'java.lang.Float': 'java.lang.Float', |
||||
|
'java.lang.Double': 'java.lang.Double', |
||||
|
'java.math.BigDecimal': 'java.math.BigDecimal', |
||||
|
'java.lang.String': 'java.lang.String', |
||||
|
'java.util.Date': 'java.util.Date', |
||||
|
'java.util.Calendar': 'java.util.Calendar', |
||||
|
}; |
||||
|
|
||||
|
const gridRef = ref(); |
||||
|
const valueType = ref(); |
||||
|
const valueTypeVersion = ref(); |
||||
|
const valueTypeIsList = ref(); |
||||
|
const valueTypeDefine = ref(); |
||||
|
const gridToolbarActions = ref<any[]>([]); |
||||
|
const gridColumns = ref<any[]>([]); |
||||
|
const gridRows = ref<any[]>([]); |
||||
|
|
||||
|
const isBoolean = computed(() => { |
||||
|
return valueType.value === 'java.lang.Boolean'; |
||||
|
}); |
||||
|
|
||||
|
const isInteger = computed(() => { |
||||
|
return valueType.value === 'java.lang.Integer' || valueType.value === 'java.lang.Long' || valueType.value === 'java.math.BigInteger'; |
||||
|
}); |
||||
|
|
||||
|
const isDecimal = computed(() => { |
||||
|
return valueType.value === 'java.lang.Float' || valueType.value === 'java.lang.Double' || valueType.value === 'java.math.BigDecimal'; |
||||
|
}); |
||||
|
|
||||
|
const isString = computed(() => { |
||||
|
return valueType.value === 'java.lang.String'; |
||||
|
}); |
||||
|
|
||||
|
const isDate = computed(() => { |
||||
|
return valueType.value === 'java.util.Date' || valueType.value === 'java.util.Calendar'; |
||||
|
}); |
||||
|
|
||||
|
const isUserDefinedJavaClass = computed(() => { |
||||
|
return Tools.isUndefinedOrNull(VALUE_TYPES[valueType.value]); |
||||
|
}); |
||||
|
|
||||
|
const setValueType = (_valueType: string) => { |
||||
|
valueType.value = _valueType; |
||||
|
refreshGrid(valueType.value, valueTypeVersion.value); |
||||
|
emit('update:modelValue', undefined); |
||||
|
}; |
||||
|
|
||||
|
const setValueTypeVersion = (_valueTypeVersion: number) => { |
||||
|
valueTypeVersion.value = _valueTypeVersion; |
||||
|
refreshGrid(valueType.value, valueTypeVersion.value); |
||||
|
emit('update:modelValue', undefined); |
||||
|
}; |
||||
|
|
||||
|
const setValueTypeIsList = (_valueTypeIsList: boolean) => { |
||||
|
valueTypeIsList.value = _valueTypeIsList; |
||||
|
refreshGrid(valueType.value, valueTypeVersion.value); |
||||
|
emit('update:modelValue', undefined); |
||||
|
}; |
||||
|
|
||||
|
const refreshGrid = async (valueType: string, version: number) => { |
||||
|
if (!Tools.isUndefinedOrNull(VALUE_TYPES[valueType]) || Tools.isUndefinedOrNull(version)) { |
||||
|
return null; |
||||
|
} |
||||
|
const manager: ParameterAndValueTypeManager = new ParameterAndValueTypeManager(); |
||||
|
await manager.load(Environment.apiContextPath('/api/re/common/parameterAndValueType/findByDictionaryCodeAndVersion/' + valueType + '/' + version)); |
||||
|
const parameters: any[] = []; |
||||
|
const parameterMap = manager.getParameters(); |
||||
|
for (const key in parameterMap) { |
||||
|
const parameter = parameterMap[key]; |
||||
|
let founded = false; |
||||
|
for (let i = 0; i < parameters.length; i++) { |
||||
|
if (parameters[i].code === parameter.code) { |
||||
|
founded = true; |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
if (!founded) { |
||||
|
parameters.push(parameter); |
||||
|
} |
||||
|
} |
||||
|
if (valueTypeIsList.value) { |
||||
|
const columns: any[] = []; |
||||
|
for (const parameter of parameters) { |
||||
|
columns.push({ |
||||
|
name: parameter.code, |
||||
|
label: parameter.name, |
||||
|
}); |
||||
|
} |
||||
|
gridToolbarActions.value = ['add', 'clone', 'edit', 'remove']; |
||||
|
gridColumns.value = columns; |
||||
|
gridRef.value?.setLocalData([]); |
||||
|
} else { |
||||
|
const columns: any[] = [ |
||||
|
{ name: 'code', label: $t('code'), showIf: false }, |
||||
|
{ name: 'name', label: $t('name') }, |
||||
|
{ name: 'value', label: $t('value') }, |
||||
|
]; |
||||
|
|
||||
|
const rows: any[] = []; |
||||
|
for (const parameter of parameters) { |
||||
|
rows.push({ |
||||
|
code: parameter.code, |
||||
|
name: parameter.name, |
||||
|
}); |
||||
|
} |
||||
|
gridToolbarActions.value = ['edit']; |
||||
|
gridColumns.value = columns; |
||||
|
gridRef.value?.setLocalData(rows); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
defineExpose({ |
||||
|
setValueType, |
||||
|
setValueTypeVersion, |
||||
|
setValueTypeIsList, |
||||
|
}); |
||||
|
</script> |
@ -0,0 +1,65 @@ |
|||||
|
<template> |
||||
|
<q-field |
||||
|
ref="fieldRef" |
||||
|
v-model="modelValue" |
||||
|
:hide-bottom-space="true" |
||||
|
:hide-hint="true" |
||||
|
:outlined="true" |
||||
|
:dense="true" |
||||
|
v-bind="attrs" |
||||
|
style="position: relative" |
||||
|
> |
||||
|
<template #label><w-label :label="attrs.label"></w-label></template> |
||||
|
<template #control> |
||||
|
<template v-if="!valueTypeIsList"> |
||||
|
<w-checkbox v-if="valueType === 'java.lang.Boolean'" v-model="modelValue"></w-checkbox> |
||||
|
<w-integer v-if="valueType === 'java.lang.Integer' || valueType === 'java.math.BigInteger'" v-model="modelValue"></w-integer> |
||||
|
<w-number |
||||
|
v-if="valueType === 'java.lang.Float' || valueType === 'java.lang.Double' || valueType === 'java.math.BigDecimal'" |
||||
|
v-model="modelValue" |
||||
|
></w-number> |
||||
|
<w-text v-if="valueType === 'java.lang.String'" v-model="modelValue"></w-text> |
||||
|
<w-date v-if="valueType === 'java.util.Date' || valueType === 'java.util.Calendar'" v-model="modelValue"></w-date> |
||||
|
</template> |
||||
|
<template v-else> |
||||
|
<w-checkbox v-if="valueType === 'java.lang.Boolean'"></w-checkbox> |
||||
|
</template> |
||||
|
</template> |
||||
|
<template #append> </template> |
||||
|
</q-field> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
import { ref, useAttrs, onMounted, onUnmounted, watch } from 'vue'; |
||||
|
import { Tools } from 'platform-core'; |
||||
|
|
||||
|
const fieldRef = ref(); |
||||
|
const attrs = useAttrs(); |
||||
|
const modelValue = defineModel<string>(); |
||||
|
const valueType = ref(); |
||||
|
const valueTypeIsList = ref(); |
||||
|
const valueTypeDefine = ref(); |
||||
|
|
||||
|
onMounted(() => {}); |
||||
|
|
||||
|
onUnmounted(() => {}); |
||||
|
|
||||
|
const setValueType = (_valueType: string) => { |
||||
|
console.log('setValueType:', setValueType); |
||||
|
valueType.value = _valueType; |
||||
|
}; |
||||
|
|
||||
|
const setValueTypeIsList = (_valueTypeIsList: boolean) => { |
||||
|
console.log('setValueTypeIsList:', valueTypeIsList); |
||||
|
valueTypeIsList.value = _valueTypeIsList; |
||||
|
}; |
||||
|
|
||||
|
const setValueTypeDefine = (_valueTypeDefine: string) => { |
||||
|
valueTypeDefine.value = _valueTypeDefine; |
||||
|
}; |
||||
|
|
||||
|
defineExpose({ |
||||
|
setValueType, |
||||
|
setValueTypeIsList, |
||||
|
setValueTypeDefine, |
||||
|
}); |
||||
|
</script> |
@ -0,0 +1,75 @@ |
|||||
|
<template> |
||||
|
<div> |
||||
|
<w-select |
||||
|
v-if="isBoolean" |
||||
|
v-model="modelValue" |
||||
|
:label="attrs.label" |
||||
|
:options="[ |
||||
|
{ label: $t('true'), value: 'true' }, |
||||
|
{ label: $t('false'), value: 'false' }, |
||||
|
]" |
||||
|
></w-select> |
||||
|
<w-integer v-else-if="isInteger" v-model="modelValue" :label="attrs.label"></w-integer> |
||||
|
<w-number v-else-if="isDecimal" v-model="modelValue" :label="attrs.label"></w-number> |
||||
|
<w-date v-else-if="isDate" v-model="modelValue" :label="attrs.label"></w-date> |
||||
|
<w-textarea v-else-if="isString" v-model="modelValue" :label="attrs.label" :rows="5"></w-textarea> |
||||
|
<w-code-mirror |
||||
|
v-else |
||||
|
v-model="modelValue" |
||||
|
:label="attrs.label" |
||||
|
lang="json" |
||||
|
:toolbar="false" |
||||
|
:button="{ |
||||
|
label: 'xxx', |
||||
|
click: () => { |
||||
|
console.log('>>>>'); |
||||
|
}, |
||||
|
}" |
||||
|
> |
||||
|
</w-code-mirror> |
||||
|
</div> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
import { ref, useAttrs, computed } from 'vue'; |
||||
|
import { $t, Tools } from 'platform-core'; |
||||
|
import { ValueTypeManager } from './ValueTypeManager'; |
||||
|
|
||||
|
const attrs = useAttrs(); |
||||
|
const modelValue = defineModel<string | number | boolean>(); |
||||
|
const emit = defineEmits(['update:modelValue']); |
||||
|
|
||||
|
const valueType = ref(); |
||||
|
const valueTypeIsList = ref(); |
||||
|
|
||||
|
const isBoolean = computed(() => { |
||||
|
return ValueTypeManager.isBoolean(valueType.value) && !valueTypeIsList.value; |
||||
|
}); |
||||
|
|
||||
|
const isInteger = computed(() => { |
||||
|
return ValueTypeManager.isInteger(valueType.value) && !valueTypeIsList.value; |
||||
|
}); |
||||
|
|
||||
|
const isDecimal = computed(() => { |
||||
|
return ValueTypeManager.isDecimal(valueType.value) && !valueTypeIsList.value; |
||||
|
}); |
||||
|
|
||||
|
const isDate = computed(() => { |
||||
|
return ValueTypeManager.isDate(valueType.value) && !valueTypeIsList.value; |
||||
|
}); |
||||
|
|
||||
|
const isString = computed(() => { |
||||
|
return ValueTypeManager.isString(valueType.value) && !valueTypeIsList.value; |
||||
|
}); |
||||
|
|
||||
|
const changeValueType = (_valueType: string, _valueTypeIsList: boolean) => { |
||||
|
valueType.value = _valueType; |
||||
|
valueTypeIsList.value = _valueTypeIsList; |
||||
|
console.log(_valueType, _valueTypeIsList); |
||||
|
//emit('update:modelValue', undefined); |
||||
|
}; |
||||
|
|
||||
|
defineExpose({ |
||||
|
//setValueType, |
||||
|
changeValueType, |
||||
|
}); |
||||
|
</script> |
File diff suppressed because it is too large
File diff suppressed because one or more lines are too long
@ -0,0 +1,39 @@ |
|||||
|
package io.sc.engine.rule.server.model.controller; |
||||
|
|
||||
|
import io.sc.engine.rule.server.model.entity.ParameterInOptionAdditionEntity; |
||||
|
import io.sc.engine.rule.server.model.entity.ParameterInOptionItemEntity; |
||||
|
import io.sc.engine.rule.server.model.repository.ParameterInOptionAdditionRepository; |
||||
|
import io.sc.engine.rule.server.model.repository.ParameterInOptionItemRepository; |
||||
|
import io.sc.engine.rule.server.model.service.ParameterInOptionAdditionService; |
||||
|
import io.sc.engine.rule.server.model.service.ParameterInOptionItemService; |
||||
|
import io.sc.engine.rule.server.model.vo.ParameterInOptionAdditionVo; |
||||
|
import io.sc.engine.rule.server.model.vo.ParameterInOptionItemVo; |
||||
|
import io.sc.engine.rule.server.model.vo.ParameterValidatorVo; |
||||
|
import io.sc.platform.mvc.controller.support.RestCrudController; |
||||
|
import io.sc.platform.orm.service.support.QueryParameter; |
||||
|
import io.sc.platform.orm.service.support.QueryResult; |
||||
|
import io.sc.platform.orm.util.EntityVoUtil; |
||||
|
import org.springframework.data.domain.Page; |
||||
|
import org.springframework.util.StringUtils; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestParam; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import java.util.Collections; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 模型参数选项 Controller |
||||
|
*/ |
||||
|
@RestController("io.sc.engine.rule.server.model.controller.ParameterInOptionAdditionWebController") |
||||
|
@RequestMapping("/api/re/model/parameter/addition") |
||||
|
public class ParameterInOptionAdditionWebController extends RestCrudController<ParameterInOptionAdditionVo, ParameterInOptionAdditionEntity,String, ParameterInOptionAdditionRepository, ParameterInOptionAdditionService> { |
||||
|
@GetMapping("findByParameterId") |
||||
|
public Page<ParameterInOptionAdditionVo> findByParameterId(@RequestParam(name="parameterId",required = false)String parameterId, QueryParameter queryParameter) throws Exception { |
||||
|
if(!StringUtils.hasText(parameterId)){ |
||||
|
return QueryResult.emptyPage(); |
||||
|
} |
||||
|
return service.findByParameterId(parameterId,queryParameter); |
||||
|
} |
||||
|
} |
@ -0,0 +1,94 @@ |
|||||
|
package io.sc.engine.rule.server.model.converter; |
||||
|
|
||||
|
import io.sc.engine.rule.core.po.model.ParameterInOptionAddtion; |
||||
|
import io.sc.engine.rule.server.model.entity.ParameterInOptionAdditionEntity; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 不录项实体转换器 |
||||
|
*/ |
||||
|
public class ParameterInOptionAdditionEntityConverter { |
||||
|
/** |
||||
|
* 将实体转换成 PO 对象 |
||||
|
* @param entity 实体对象 |
||||
|
* @return PO 对象 |
||||
|
*/ |
||||
|
public static ParameterInOptionAddtion toPo(ParameterInOptionAdditionEntity entity) { |
||||
|
if(entity!=null) { |
||||
|
ParameterInOptionAddtion po =new ParameterInOptionAddtion(); |
||||
|
po.setId(entity.getId()); |
||||
|
po.setCode(entity.getCode()); |
||||
|
po.setName(entity.getName()); |
||||
|
po.setDescription(entity.getDescription()); |
||||
|
po.setComponentType(entity.getComponentType()); |
||||
|
po.setCondition(entity.getCondition()); |
||||
|
po.setEnable(entity.getEnable()); |
||||
|
po.setOrder(entity.getOrder()); |
||||
|
po.setRows(entity.getRows()); |
||||
|
po.setPrompt(entity.getPrompt()); |
||||
|
po.setAttachmentExtendNames(entity.getAttachmentExtendNames()); |
||||
|
po.setAttachmentMaxCount(entity.getAttachmentMaxCount()); |
||||
|
return po; |
||||
|
} |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 将实体集合转换成 PO 对象集合 |
||||
|
* @param entities 实体集合 |
||||
|
* @return PO 对象集合 |
||||
|
*/ |
||||
|
public static List<ParameterInOptionAddtion> toPo(List<ParameterInOptionAdditionEntity> entities){ |
||||
|
if(entities!=null && entities.size()>0) { |
||||
|
List<ParameterInOptionAddtion> pos =new ArrayList<>(entities.size()); |
||||
|
for(ParameterInOptionAdditionEntity entity : entities) { |
||||
|
pos.add(toPo(entity)); |
||||
|
} |
||||
|
return pos; |
||||
|
} |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 将 PO 对象转换成实体对象 |
||||
|
* @param po PO 对象 |
||||
|
* @return 实体对象 |
||||
|
*/ |
||||
|
public static ParameterInOptionAdditionEntity fromPo(ParameterInOptionAddtion po) { |
||||
|
if(po!=null) { |
||||
|
ParameterInOptionAdditionEntity entity =new ParameterInOptionAdditionEntity(); |
||||
|
entity.setId(po.getId()); |
||||
|
entity.setCode(po.getCode()); |
||||
|
entity.setName(po.getName()); |
||||
|
entity.setDescription(po.getDescription()); |
||||
|
entity.setComponentType(po.getComponentType()); |
||||
|
entity.setCondition(po.getCondition()); |
||||
|
entity.setEnable(po.getEnable()); |
||||
|
entity.setOrder(po.getOrder()); |
||||
|
entity.setRows(po.getRows()); |
||||
|
entity.setPrompt(po.getPrompt()); |
||||
|
entity.setAttachmentExtendNames(po.getAttachmentExtendNames()); |
||||
|
entity.setAttachmentMaxCount(po.getAttachmentMaxCount()); |
||||
|
return entity; |
||||
|
} |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 将 PO 对象集合转换成实体对象集合 |
||||
|
* @param pos PO 对象集合 |
||||
|
* @return 实体对象集合 |
||||
|
*/ |
||||
|
public static List<ParameterInOptionAdditionEntity> fromPo(List<ParameterInOptionAddtion> pos){ |
||||
|
if(pos!=null && pos.size()>0) { |
||||
|
List<ParameterInOptionAdditionEntity> entities =new ArrayList<>(pos.size()); |
||||
|
for(ParameterInOptionAddtion po : pos) { |
||||
|
entities.add(fromPo(po)); |
||||
|
} |
||||
|
return entities; |
||||
|
} |
||||
|
return null; |
||||
|
} |
||||
|
} |
@ -0,0 +1,220 @@ |
|||||
|
package io.sc.engine.rule.server.model.entity; |
||||
|
|
||||
|
import io.sc.engine.rule.core.enums.QualitativeAdditionComponentType; |
||||
|
import io.sc.engine.rule.server.model.vo.ParameterInOptionAdditionVo; |
||||
|
import io.sc.platform.orm.DeepClone; |
||||
|
import io.sc.platform.orm.IdClearable; |
||||
|
import io.sc.platform.orm.converter.NumericBooleanConverter; |
||||
|
import io.sc.platform.orm.entity.CorporationAuditorEntity; |
||||
|
import org.hibernate.annotations.GenericGenerator; |
||||
|
import org.springframework.beans.BeanUtils; |
||||
|
|
||||
|
import javax.persistence.*; |
||||
|
import javax.validation.constraints.Size; |
||||
|
|
||||
|
/** |
||||
|
* 输入值(选项)参数的补录项实体类 |
||||
|
*/ |
||||
|
@Entity |
||||
|
@Table(name="RE_MODEL_PARAMETER_ADDITION") |
||||
|
public class ParameterInOptionAdditionEntity extends CorporationAuditorEntity<ParameterInOptionAdditionVo> implements DeepClone, IdClearable { |
||||
|
//ID,主键
|
||||
|
@Id |
||||
|
@GeneratedValue(generator = "system-uuid") |
||||
|
@GenericGenerator(name = "system-uuid", strategy = "uuid2") |
||||
|
@Column(name="ID_", length=36) |
||||
|
@Size(max=36) |
||||
|
protected String id; |
||||
|
|
||||
|
//所属参数
|
||||
|
@ManyToOne(fetch=FetchType.LAZY) |
||||
|
@JoinColumn(name="PARAMETER_ID_") |
||||
|
protected ParameterEntity parameter; |
||||
|
|
||||
|
//代码
|
||||
|
@Column(name="CODE_", length=255) |
||||
|
@Size(max=255) |
||||
|
protected String code; |
||||
|
|
||||
|
//名称
|
||||
|
@Column(name="NAME_", length=255) |
||||
|
@Size(max=255) |
||||
|
protected String name; |
||||
|
|
||||
|
//描述
|
||||
|
@Column(name="DESCRIPTION_", length=255) |
||||
|
@Size(max=255) |
||||
|
protected String description; |
||||
|
|
||||
|
//组件类型
|
||||
|
@Column(name="COMPONENT_TYPE_") |
||||
|
@Enumerated(EnumType.STRING) |
||||
|
protected QualitativeAdditionComponentType componentType; |
||||
|
|
||||
|
//触发条件
|
||||
|
@Column(name="CONDITION_", length=1024) |
||||
|
@Size(max=1024) |
||||
|
protected String condition; |
||||
|
|
||||
|
//是否可用
|
||||
|
@Column(name="ENABLE_") |
||||
|
@Convert(converter= NumericBooleanConverter.class) |
||||
|
protected Boolean enable =true; |
||||
|
|
||||
|
//排序
|
||||
|
@Column(name="ORDER_") |
||||
|
protected Integer order; |
||||
|
|
||||
|
//当组件类型是 TEXTS(多行文本框) 时, 指定多行文本框组件的行数
|
||||
|
@Column(name="ROWS_") |
||||
|
protected Integer rows; |
||||
|
|
||||
|
//当组件类型是 TEXT(单行文本框) 或 TEXTS(多行文本框) 时, 指定文本框组件的提示词
|
||||
|
@Column(name="PROMPT_", length=1024) |
||||
|
@Size(max=1024) |
||||
|
protected String prompt; |
||||
|
|
||||
|
//当组件类型是 ATTACHMENT(附件) 时, 指定允许上传附件的文件扩展名
|
||||
|
@Column(name="ATTACHMENT_EXT_NAMES_") |
||||
|
protected String attachmentExtendNames; |
||||
|
|
||||
|
//当组件类型是 ATTACHMENT(附件) 时, 指定最大允许上传附件的个数
|
||||
|
@Column(name="ATTACHMENT_MAX_COUNT_") |
||||
|
protected Integer attachmentMaxCount; |
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
public ParameterInOptionAdditionVo toVo() { |
||||
|
ParameterInOptionAdditionVo vo =new ParameterInOptionAdditionVo(); |
||||
|
super.toVo(vo); |
||||
|
vo.setId(this.getId()); |
||||
|
vo.setParameter(this.getParameter()==null?null:this.getParameter().getId()); |
||||
|
vo.setCode(this.getCode()); |
||||
|
vo.setName(this.getName()); |
||||
|
vo.setDescription(this.getDescription()); |
||||
|
vo.setComponentType(this.getComponentType()); |
||||
|
vo.setCondition(this.getCondition()); |
||||
|
vo.setEnable(this.getEnable()); |
||||
|
vo.setOrder(this.getOrder()); |
||||
|
vo.setRows(this.getRows()); |
||||
|
vo.setPrompt(this.getPrompt()); |
||||
|
vo.setAttachmentExtendNames(this.getAttachmentExtendNames()); |
||||
|
vo.setAttachmentMaxCount(this.getAttachmentMaxCount()); |
||||
|
return vo; |
||||
|
} |
||||
|
|
||||
|
public String getId() { |
||||
|
return id; |
||||
|
} |
||||
|
|
||||
|
public void setId(String id) { |
||||
|
this.id = id; |
||||
|
} |
||||
|
|
||||
|
public ParameterEntity getParameter() { |
||||
|
return parameter; |
||||
|
} |
||||
|
|
||||
|
public void setParameter(ParameterEntity parameter) { |
||||
|
this.parameter = parameter; |
||||
|
} |
||||
|
|
||||
|
public String getCode() { |
||||
|
return code; |
||||
|
} |
||||
|
|
||||
|
public void setCode(String code) { |
||||
|
this.code = code; |
||||
|
} |
||||
|
|
||||
|
public String getName() { |
||||
|
return name; |
||||
|
} |
||||
|
|
||||
|
public void setName(String name) { |
||||
|
this.name = name; |
||||
|
} |
||||
|
|
||||
|
public String getDescription() { |
||||
|
return description; |
||||
|
} |
||||
|
|
||||
|
public void setDescription(String description) { |
||||
|
this.description = description; |
||||
|
} |
||||
|
|
||||
|
public QualitativeAdditionComponentType getComponentType() { |
||||
|
return componentType; |
||||
|
} |
||||
|
|
||||
|
public void setComponentType(QualitativeAdditionComponentType componentType) { |
||||
|
this.componentType = componentType; |
||||
|
} |
||||
|
|
||||
|
public String getCondition() { |
||||
|
return condition; |
||||
|
} |
||||
|
|
||||
|
public void setCondition(String condition) { |
||||
|
this.condition = condition; |
||||
|
} |
||||
|
|
||||
|
public Boolean getEnable() { |
||||
|
return enable; |
||||
|
} |
||||
|
|
||||
|
public void setEnable(Boolean enable) { |
||||
|
this.enable = enable; |
||||
|
} |
||||
|
|
||||
|
public Integer getOrder() { |
||||
|
return order; |
||||
|
} |
||||
|
|
||||
|
public void setOrder(Integer order) { |
||||
|
this.order = order; |
||||
|
} |
||||
|
|
||||
|
public Integer getRows() { |
||||
|
return rows; |
||||
|
} |
||||
|
|
||||
|
public void setRows(Integer rows) { |
||||
|
this.rows = rows; |
||||
|
} |
||||
|
|
||||
|
public String getPrompt() { |
||||
|
return prompt; |
||||
|
} |
||||
|
|
||||
|
public void setPrompt(String prompt) { |
||||
|
this.prompt = prompt; |
||||
|
} |
||||
|
|
||||
|
public String getAttachmentExtendNames() { |
||||
|
return attachmentExtendNames; |
||||
|
} |
||||
|
|
||||
|
public void setAttachmentExtendNames(String attachmentExtendNames) { |
||||
|
this.attachmentExtendNames = attachmentExtendNames; |
||||
|
} |
||||
|
|
||||
|
public Integer getAttachmentMaxCount() { |
||||
|
return attachmentMaxCount; |
||||
|
} |
||||
|
|
||||
|
public void setAttachmentMaxCount(Integer attachmentMaxCount) { |
||||
|
this.attachmentMaxCount = attachmentMaxCount; |
||||
|
} |
||||
|
|
||||
|
public Object deepClone() { |
||||
|
ParameterInOptionAdditionEntity entity =new ParameterInOptionAdditionEntity(); |
||||
|
BeanUtils.copyProperties(this, entity); |
||||
|
return entity; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void clearId() { |
||||
|
this.setId(null); |
||||
|
} |
||||
|
} |
@ -0,0 +1,18 @@ |
|||||
|
package io.sc.engine.rule.server.model.repository; |
||||
|
|
||||
|
import io.sc.engine.rule.server.model.entity.ParameterInOptionAdditionEntity; |
||||
|
import io.sc.platform.orm.repository.DaoRepository; |
||||
|
import org.springframework.data.jpa.repository.Query; |
||||
|
import org.springframework.data.repository.query.Param; |
||||
|
import org.springframework.stereotype.Repository; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
@Repository("io.sc.engine.rule.server.model.repository.ParameterInOptionAdditionRepository") |
||||
|
public interface ParameterInOptionAdditionRepository extends DaoRepository<ParameterInOptionAdditionEntity,String>{ |
||||
|
@Query("select max(e.order)+1 from ParameterInOptionAdditionEntity e where e.parameter.id=:parameterId") |
||||
|
public Integer getNextOrder(@Param("parameterId") String parameterId); |
||||
|
|
||||
|
@Query("select e from ParameterInOptionAdditionEntity e where e.parameter.id=:parameterId order by e.order") |
||||
|
public List<ParameterInOptionAdditionEntity> findByParameterId(@Param("parameterId") String parameterId); |
||||
|
} |
@ -0,0 +1,24 @@ |
|||||
|
package io.sc.engine.rule.server.model.service; |
||||
|
|
||||
|
import io.sc.engine.rule.server.model.entity.ParameterInOptionAdditionEntity; |
||||
|
import io.sc.engine.rule.server.model.repository.ParameterInOptionAdditionRepository; |
||||
|
import io.sc.engine.rule.server.model.vo.ParameterInOptionAdditionVo; |
||||
|
import io.sc.platform.orm.service.DaoService; |
||||
|
import io.sc.platform.orm.service.support.QueryParameter; |
||||
|
import org.springframework.data.domain.Page; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 输入参数补录项服务接口 |
||||
|
*/ |
||||
|
public interface ParameterInOptionAdditionService extends DaoService<ParameterInOptionAdditionEntity, String, ParameterInOptionAdditionRepository>{ |
||||
|
/** |
||||
|
* 通过参数ID查找补录项 |
||||
|
* @param parameterId 参数ID |
||||
|
* @param queryParameter 查询参数 |
||||
|
* @return 补录项列表 |
||||
|
* @throws Exception 违例 |
||||
|
*/ |
||||
|
public Page<ParameterInOptionAdditionVo> findByParameterId(String parameterId, QueryParameter queryParameter) throws Exception; |
||||
|
} |
@ -0,0 +1,45 @@ |
|||||
|
package io.sc.engine.rule.server.model.service.impl; |
||||
|
|
||||
|
import io.sc.engine.rule.server.model.entity.ParameterInOptionAdditionEntity; |
||||
|
import io.sc.engine.rule.server.model.entity.ParameterInOptionItemEntity; |
||||
|
import io.sc.engine.rule.server.model.repository.ParameterInOptionAdditionRepository; |
||||
|
import io.sc.engine.rule.server.model.repository.ParameterInOptionItemRepository; |
||||
|
import io.sc.engine.rule.server.model.service.ParameterInOptionAdditionService; |
||||
|
import io.sc.engine.rule.server.model.service.ParameterInOptionItemService; |
||||
|
import io.sc.engine.rule.server.model.vo.ParameterInOptionAdditionVo; |
||||
|
import io.sc.platform.orm.service.impl.DaoServiceImpl; |
||||
|
import io.sc.platform.orm.service.support.QueryParameter; |
||||
|
import io.sc.platform.orm.service.support.QueryResult; |
||||
|
import io.sc.platform.orm.service.support.criteria.impl.Equals; |
||||
|
import io.sc.platform.orm.util.EntityVoUtil; |
||||
|
import org.springframework.data.domain.Page; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
@Service("io.sc.engine.rule.server.model.service.impl.ParameterInOptionAdditionServiceImpl") |
||||
|
public class ParameterInOptionAdditionServiceImpl extends DaoServiceImpl<ParameterInOptionAdditionEntity, String, ParameterInOptionAdditionRepository> implements ParameterInOptionAdditionService { |
||||
|
|
||||
|
@Override |
||||
|
public Page<ParameterInOptionAdditionVo> findByParameterId(String parameterId, QueryParameter queryParameter) throws Exception { |
||||
|
Equals equalsCriteria =new Equals(); |
||||
|
equalsCriteria.setFieldName("parameter"); |
||||
|
equalsCriteria.setValue(parameterId); |
||||
|
|
||||
|
queryParameter.addCriteria(equalsCriteria); |
||||
|
return EntityVoUtil.toVo(super.query(queryParameter)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional |
||||
|
public ParameterInOptionAdditionEntity add(ParameterInOptionAdditionEntity entity) throws Exception { |
||||
|
Integer nextOrder =repository.getNextOrder(entity.getParameter().getId()); |
||||
|
if(nextOrder!=null) { |
||||
|
entity.setOrder(nextOrder); |
||||
|
}else { |
||||
|
entity.setOrder(1); |
||||
|
} |
||||
|
return super.add(entity); |
||||
|
} |
||||
|
} |
@ -0,0 +1,131 @@ |
|||||
|
package io.sc.engine.rule.server.model.vo; |
||||
|
|
||||
|
import io.sc.engine.rule.core.enums.QualitativeAdditionComponentType; |
||||
|
import io.sc.platform.orm.api.vo.CorporationAuditorVo; |
||||
|
|
||||
|
import javax.persistence.Column; |
||||
|
import javax.validation.constraints.Size; |
||||
|
|
||||
|
/** |
||||
|
* 输入值(选项)参数的补录项 Vo 类 |
||||
|
*/ |
||||
|
public class ParameterInOptionAdditionVo extends CorporationAuditorVo { |
||||
|
protected String id; |
||||
|
protected String parameter; |
||||
|
protected String code; |
||||
|
protected String name; |
||||
|
protected String description; |
||||
|
protected QualitativeAdditionComponentType componentType; |
||||
|
protected String condition; |
||||
|
protected Boolean enable =true; |
||||
|
protected Integer order; |
||||
|
|
||||
|
protected Integer rows; |
||||
|
protected String prompt; |
||||
|
protected String attachmentExtendNames; |
||||
|
protected Integer attachmentMaxCount; |
||||
|
|
||||
|
public String getId() { |
||||
|
return id; |
||||
|
} |
||||
|
|
||||
|
public void setId(String id) { |
||||
|
this.id = id; |
||||
|
} |
||||
|
|
||||
|
public String getParameter() { |
||||
|
return parameter; |
||||
|
} |
||||
|
|
||||
|
public void setParameter(String parameter) { |
||||
|
this.parameter = parameter; |
||||
|
} |
||||
|
|
||||
|
public String getCode() { |
||||
|
return code; |
||||
|
} |
||||
|
|
||||
|
public void setCode(String code) { |
||||
|
this.code = code; |
||||
|
} |
||||
|
|
||||
|
public String getName() { |
||||
|
return name; |
||||
|
} |
||||
|
|
||||
|
public void setName(String name) { |
||||
|
this.name = name; |
||||
|
} |
||||
|
|
||||
|
public String getDescription() { |
||||
|
return description; |
||||
|
} |
||||
|
|
||||
|
public void setDescription(String description) { |
||||
|
this.description = description; |
||||
|
} |
||||
|
|
||||
|
public QualitativeAdditionComponentType getComponentType() { |
||||
|
return componentType; |
||||
|
} |
||||
|
|
||||
|
public void setComponentType(QualitativeAdditionComponentType componentType) { |
||||
|
this.componentType = componentType; |
||||
|
} |
||||
|
|
||||
|
public String getCondition() { |
||||
|
return condition; |
||||
|
} |
||||
|
|
||||
|
public void setCondition(String condition) { |
||||
|
this.condition = condition; |
||||
|
} |
||||
|
|
||||
|
public Boolean getEnable() { |
||||
|
return enable; |
||||
|
} |
||||
|
|
||||
|
public void setEnable(Boolean enable) { |
||||
|
this.enable = enable; |
||||
|
} |
||||
|
|
||||
|
public Integer getOrder() { |
||||
|
return order; |
||||
|
} |
||||
|
|
||||
|
public void setOrder(Integer order) { |
||||
|
this.order = order; |
||||
|
} |
||||
|
|
||||
|
public Integer getRows() { |
||||
|
return rows; |
||||
|
} |
||||
|
|
||||
|
public void setRows(Integer rows) { |
||||
|
this.rows = rows; |
||||
|
} |
||||
|
|
||||
|
public String getPrompt() { |
||||
|
return prompt; |
||||
|
} |
||||
|
|
||||
|
public void setPrompt(String prompt) { |
||||
|
this.prompt = prompt; |
||||
|
} |
||||
|
|
||||
|
public String getAttachmentExtendNames() { |
||||
|
return attachmentExtendNames; |
||||
|
} |
||||
|
|
||||
|
public void setAttachmentExtendNames(String attachmentExtendNames) { |
||||
|
this.attachmentExtendNames = attachmentExtendNames; |
||||
|
} |
||||
|
|
||||
|
public Integer getAttachmentMaxCount() { |
||||
|
return attachmentMaxCount; |
||||
|
} |
||||
|
|
||||
|
public void setAttachmentMaxCount(Integer attachmentMaxCount) { |
||||
|
this.attachmentMaxCount = attachmentMaxCount; |
||||
|
} |
||||
|
} |
@ -1,68 +1,26 @@ |
|||||
package io.sc.engine.rule.server.model.vo.parameter; |
package io.sc.engine.rule.server.model.vo.parameter; |
||||
|
|
||||
import io.sc.engine.rule.core.enums.ParameterType; |
import io.sc.engine.rule.core.enums.ParameterType; |
||||
import io.sc.engine.rule.core.enums.QualitativeAdditionAttachmentMode; |
|
||||
import io.sc.engine.rule.core.enums.QualitativeAdditionComponentType; |
import io.sc.engine.rule.core.enums.QualitativeAdditionComponentType; |
||||
import io.sc.engine.rule.core.enums.QualitativeAdditionMode; |
|
||||
import io.sc.engine.rule.server.model.vo.ParameterVo; |
import io.sc.engine.rule.server.model.vo.ParameterVo; |
||||
|
|
||||
/** |
/** |
||||
* 模型参数(输入选项) Vo 类 |
* 模型参数(输入选项) Vo 类 |
||||
*/ |
*/ |
||||
public class InOptionParameterVo extends ParameterVo { |
public class InOptionParameterVo extends ParameterVo { |
||||
//补录模式
|
//补录项配置
|
||||
protected QualitativeAdditionMode additionMode; |
protected String additionConfigure; |
||||
//补录标题
|
|
||||
protected String additionTitle; |
|
||||
//补录描述
|
|
||||
protected String additionDescription; |
|
||||
//补录组件类型
|
|
||||
protected QualitativeAdditionComponentType additionComponentType; |
|
||||
//补录附件模式
|
|
||||
protected QualitativeAdditionAttachmentMode additionAttachmentMode; |
|
||||
|
|
||||
@Override |
@Override |
||||
public ParameterType getType() { |
public ParameterType getType() { |
||||
return ParameterType.IN_OPTION; |
return ParameterType.IN_OPTION; |
||||
} |
} |
||||
|
|
||||
public QualitativeAdditionMode getAdditionMode() { |
public String getAdditionConfigure() { |
||||
return additionMode; |
return additionConfigure; |
||||
} |
} |
||||
|
|
||||
public void setAdditionMode(QualitativeAdditionMode additionMode) { |
public void setAdditionConfigure(String additionConfigure) { |
||||
this.additionMode = additionMode; |
this.additionConfigure = additionConfigure; |
||||
} |
|
||||
|
|
||||
public String getAdditionTitle() { |
|
||||
return additionTitle; |
|
||||
} |
|
||||
|
|
||||
public void setAdditionTitle(String additionTitle) { |
|
||||
this.additionTitle = additionTitle; |
|
||||
} |
|
||||
|
|
||||
public String getAdditionDescription() { |
|
||||
return additionDescription; |
|
||||
} |
|
||||
|
|
||||
public void setAdditionDescription(String additionDescription) { |
|
||||
this.additionDescription = additionDescription; |
|
||||
} |
|
||||
|
|
||||
public QualitativeAdditionComponentType getAdditionComponentType() { |
|
||||
return additionComponentType; |
|
||||
} |
|
||||
|
|
||||
public void setAdditionComponentType(QualitativeAdditionComponentType additionComponentType) { |
|
||||
this.additionComponentType = additionComponentType; |
|
||||
} |
|
||||
|
|
||||
public QualitativeAdditionAttachmentMode getAdditionAttachmentMode() { |
|
||||
return additionAttachmentMode; |
|
||||
} |
|
||||
|
|
||||
public void setAdditionAttachmentMode(QualitativeAdditionAttachmentMode additionAttachmentMode) { |
|
||||
this.additionAttachmentMode = additionAttachmentMode; |
|
||||
} |
} |
||||
} |
} |
||||
|
File diff suppressed because it is too large
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
File diff suppressed because one or more lines are too long
@ -0,0 +1,62 @@ |
|||||
|
<template> |
||||
|
<w-dialog ref="dialogRef" width="800px" :title="$t('systemAnnouncements')" :can-maximize="false" @hide="Environment.executeAction('loadSystemAnnouncements')"> |
||||
|
<q-carousel |
||||
|
v-model="slideRef" |
||||
|
transition-prev="scale" |
||||
|
transition-next="scale" |
||||
|
swipeable |
||||
|
animated |
||||
|
control-type="outline" |
||||
|
control-color="primary" |
||||
|
navigation |
||||
|
padding |
||||
|
arrows |
||||
|
height="500px" |
||||
|
@update:model-value="updateLastReadAnnouncementDate" |
||||
|
> |
||||
|
<q-carousel-slide v-for="item in systemAnnouncementsRef" :key="item.id" :name="item.id" class="column no-wrap"> |
||||
|
<div class="text-lg font-bold">{{ item.title }} ({{ item.lastModifyDate }})</div> |
||||
|
<div class="q-mt-md overflow-auto" style="height: 350px" v-html="item.content"></div> |
||||
|
</q-carousel-slide> |
||||
|
</q-carousel> |
||||
|
</w-dialog> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
import { ref } from 'vue'; |
||||
|
import { axios, PConst, Environment, noErrorAxios, NotifyManager } from '@/platform'; |
||||
|
|
||||
|
const dialogRef = ref(); |
||||
|
const itemRef = ref(); |
||||
|
const systemAnnouncementsRef = ref(); |
||||
|
const slideRef = ref(); |
||||
|
|
||||
|
const open = async (item) => { |
||||
|
itemRef.value = item; |
||||
|
slideRef.value = item.id; |
||||
|
dialogRef.value.show(); |
||||
|
await loadSystemAnnouncements(); |
||||
|
updateLastReadAnnouncementDate(); |
||||
|
}; |
||||
|
|
||||
|
const close = () => { |
||||
|
dialogRef.value.hide(); |
||||
|
}; |
||||
|
|
||||
|
const loadSystemAnnouncements = async () => { |
||||
|
const response = await axios.get(Environment.apiContextPath('/api/system/announcement/findUnReadedAnnouncements')); |
||||
|
systemAnnouncementsRef.value = response.data.content || []; |
||||
|
}; |
||||
|
|
||||
|
const updateLastReadAnnouncementDate = () => { |
||||
|
for (const item of systemAnnouncementsRef.value) { |
||||
|
if (item.id === slideRef.value) { |
||||
|
axios.post(Environment.apiContextPath('/api/system/user/updateLastReadAnnouncementDate'), { lastReadAnnouncementDate: item.lastModifyDate }); |
||||
|
} |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
defineExpose({ |
||||
|
open, |
||||
|
close, |
||||
|
}); |
||||
|
</script> |
@ -0,0 +1,130 @@ |
|||||
|
<template> |
||||
|
<w-dialog ref="dialogRef" width="800px" :title="$t('myMessages')" :can-maximize="false" @hide="Environment.executeAction('loadSystemAnnouncements')"> |
||||
|
<q-splitter :model-value="125" unit="px" reverse horizontal style="height: 500px" separator-style="height:2px"> |
||||
|
<template #before> |
||||
|
<div class="py-2" style="height: 100%"> |
||||
|
<div class="px-4 py-2 overflow-auto" style="height: 100%"> |
||||
|
<template v-for="item in messagesRef" :key="item.id"> |
||||
|
<q-chat-message |
||||
|
v-if="item.sender === SessionManager.getSession().user.loginName" |
||||
|
:id="item.id" |
||||
|
:name="item.sendDateAndNowDiff + $t(item.sendDateAndNowDiffUnit) + $t('before')" |
||||
|
:text="[item.title]" |
||||
|
sent |
||||
|
text-color="white" |
||||
|
bg-color="primary" |
||||
|
> |
||||
|
<template #avatar> |
||||
|
<q-icon name="bi-person-circle" size="48px" color="blue" right /> |
||||
|
</template> |
||||
|
</q-chat-message> |
||||
|
<q-chat-message |
||||
|
v-else |
||||
|
:id="item.id" |
||||
|
:name="item.sendDateAndNowDiff + $t(item.sendDateAndNowDiffUnit) + $t('before')" |
||||
|
bg-color="green" |
||||
|
style="width: 85%" |
||||
|
> |
||||
|
<template #avatar> |
||||
|
<q-icon name="bi-flower2" size="36px" color="green" left /> |
||||
|
</template> |
||||
|
<q-markdown :src="':::\n' + item.title + '\n:::'"> </q-markdown> |
||||
|
</q-chat-message> |
||||
|
</template> |
||||
|
</div> |
||||
|
</div> |
||||
|
</template> |
||||
|
<template #after> |
||||
|
<div class="pt-1" style="height: 100%"> |
||||
|
<q-input |
||||
|
ref="textareaRef" |
||||
|
v-model="questionRef" |
||||
|
type="textarea" |
||||
|
rows="5" |
||||
|
outlined |
||||
|
clearable |
||||
|
style="height: 100%" |
||||
|
@keydown.enter.prevent="sendMessage" |
||||
|
/> |
||||
|
</div> |
||||
|
</template> |
||||
|
</q-splitter> |
||||
|
</w-dialog> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
import { ref, reactive, nextTick } from 'vue'; |
||||
|
import { useQuasar, uid } from 'quasar'; |
||||
|
import { axios, PConst, Environment, SessionManager, noErrorAxios, NotifyManager } from '@/platform'; |
||||
|
|
||||
|
const $q = useQuasar(); |
||||
|
const dialogRef = ref(); |
||||
|
const itemRef = ref(); |
||||
|
|
||||
|
const textareaRef = ref(); |
||||
|
const questionRef = ref(); |
||||
|
const questionHistoryRef = ref([]); |
||||
|
const showThinkRef = ref(true); |
||||
|
const messagesRef = ref([]); |
||||
|
const imeRef = ref(false); |
||||
|
|
||||
|
const open = async (item) => { |
||||
|
itemRef.value = item; |
||||
|
dialogRef.value.show(); |
||||
|
loadNotifications(); |
||||
|
}; |
||||
|
|
||||
|
const close = () => { |
||||
|
dialogRef.value.hide(); |
||||
|
}; |
||||
|
|
||||
|
const loadNotifications = async () => { |
||||
|
axios.get(Environment.apiContextPath('/api/system/notification/findNotificationsBySender/' + itemRef.value.sender)).then((response) => { |
||||
|
messagesRef.value = response.data || []; |
||||
|
// 定位到最后一个回答消息 |
||||
|
nextTick(() => { |
||||
|
if (messagesRef.value && messagesRef.value.length > 0) { |
||||
|
document.getElementById(messagesRef.value[messagesRef.value.length - 1].id).scrollIntoView(); |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const updateLastReadAnnouncementDate = () => {}; |
||||
|
|
||||
|
const sendMessage = (event: any) => { |
||||
|
if (imeRef.value) { |
||||
|
// 如果正在输入法下输入,此时输入回车是确认输入 |
||||
|
return; |
||||
|
} |
||||
|
if (($q.platform.is.mac && event.metaKey) || ($q.platform.is.win && event.ctrlKey)) { |
||||
|
// command/ctrl+回车 处理 |
||||
|
const element = textareaRef.value.getNativeElement(); |
||||
|
const start = element.selectionStart; |
||||
|
const end = element.selectionEnd; |
||||
|
const text = questionRef.value; |
||||
|
const leftText = text.substring(0, element.selectionStart); |
||||
|
const rightText = text.substring(element.selectionEnd); |
||||
|
questionRef.value = leftText + '\n' + rightText; |
||||
|
nextTick(() => { |
||||
|
element.selectionEnd = start + 1; |
||||
|
}); |
||||
|
return; |
||||
|
} else { |
||||
|
axios |
||||
|
.post(Environment.apiContextPath('/api/system/notification'), { |
||||
|
receiver: itemRef.value.sender, |
||||
|
title: questionRef.value, |
||||
|
content: questionRef.value, |
||||
|
}) |
||||
|
.then((response) => { |
||||
|
loadNotifications(); |
||||
|
}); |
||||
|
questionRef.value = ''; |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
defineExpose({ |
||||
|
open, |
||||
|
close, |
||||
|
}); |
||||
|
</script> |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue