提交 9aef90da 编写于 作者: Mosher's avatar Mosher

update:更新

上级 6065e79b
{
name: '{{logic.name}}',
logicType: '{{logic.logicType}}',
logicCat: '{{logic.logicCat}}',
{{#eq logic.logicType 'GROUP'}}
notMode: {{logic.notMode}},
groupOP: '{{logic.groupOP}}',
relatedDetailNames: [{{#each logic.relatedDetailNames as | name |}}"{{name}}"{{#unless @last}},{{/unless}}{{/each}}],
{{#if logic.psDEFDLogics}}
childLogics: [
{{#each logic.psDEFDLogics as | childLogic |}}
{{> @macro/front-end/common/delogic.hbs logic=childLogic}}
{{/each}}
]
{{/if}}
{{/eq}}
{{#eq logic.logicType 'SINGLE'}}
condOP: "{{logic.condOP}}",
dEFDName: "{{lowerCase logic.dEFDName}}",
value: "{{logic.value}}"
{{/eq}}
},
{{#each item.psDEFormDetails as | tempDetail |}}
{{#if (and (eq tempDetail.detailType "BUTTON") tempDetail.psUIAction)}}
{{#tempDetail.psUIAction}}
{{#each item.psDEFormDetails as | detail |}}
{{#if (and (eq detail.detailType "BUTTON") detail.psUIAction)}}
{{#detail.psUIAction}}
'{{uIActionTag}}': { disabled: false, visible: true, noPrivDisplayMode: "{{noPrivDisplayMode}}", dataAccessAction: '{{dataAccessAction}}', actionTarget: '{{actionTarget}}' },
{{/tempDetail.psUIAction}}
{{/detail.psUIAction}}
{{/if}}
{{#if (and (eq tempDetail.detailType "GROUPPANEL") tempDetail.psSUIActionGroup tempDetail.psSUIActionGroup.psUIActionGroupDetails)}}
{{#each tempDetail.psSUIActionGroup.psUIActionGroupDetails as | detail | }}
{{#if (and (eq detail.detailType "GROUPPANEL") detail.psUIActionGroup detail.psUIActionGroup.psUIActionGroupDetails)}}
{{#each detail.psUIActionGroup.psUIActionGroupDetails as | detail | }}
{{#detail.psUIAction}}
'{{uIActionTag}}': { disabled: false, visible: true, noPrivDisplayMode: "{{noPrivDisplayMode}}", dataAccessAction: '{{dataAccessAction}}', actionTarget: '{{actionTarget}}' },
{{/detail.psUIAction}}
{{/each}}
{{/if}}
{{#if tempDetail.psDEFormDetails}}
{{> @macro/front-end/widgets/form-detail/form-action-model.hbs item=tempDetail}}
{{#if detail.psDEFormDetails}}
{{> @macro/front-end/widgets/form-detail/form-action-model.hbs item=detail}}
{{/if}}
{{/each}}
......@@ -21,4 +21,6 @@
{{#if item.caption}}
caption="{{item.caption}}"
{{/if}}
:uIAction="state.detailsModel.{{item.codeName}}.uIAction"
@action="onComponentEvent"
/>
......@@ -24,7 +24,7 @@
scriptCode: `{{item.psDEFormItemUpdate.scriptCode}}`,
{{else}}
showBusyIndicator: "{{item.psDEFormItemUpdate.showBusyIndicator}}",
{{!-- appDEMethod: "{{item.psDEFormItemUpdate.psAppDEMethod.codeName}}", --}}
appDEMethod: "{{item.psDEFormItemUpdate.psAppDEMethod.codeName}}",
updateDetails: [
{{#each item.psDEFormItemUpdate.psDEFIUpdateDetails as | updateDetails | }}
"{{updateDetails.name}}",
......@@ -33,14 +33,6 @@
{{/if}}
},
{{/if}}
{{#if item.createDVT}}
createDVT: "{{item.createDVT}}",
createDV: "{{item.createDV}}",
{{/if}}
{{#if item.updateDVT}}
updateDVT: "{{item.updateDVT}}",
updateDV: "{{item.updateDV}}",
{{/if}}
{{#if item.resetItemName}}
resetItemName: '{{item.resetItemName}}',
{{/if}}
......@@ -49,7 +41,8 @@
{{/if}}
{{/if}}
{{#if (and (eq item.detailType "BUTTON") item.psUIAction)}}
uIActionTag: '{{item.psUIAction.uIActionTag}}',
{{!-- TODO 补充显示图标和文字模式 --}}
uIAction: { caption: '{{item.psUIAction.caption}}', uIActionMode: "{{item.psUIAction.uIActionMode}}", disabled: false, visible: true, uIActionTag: '{{detail.psUIAction.uIActionTag}}', showCaption: {{item.showCaption}}, {{#if item.psUIAction.psSysImage}}{{#if item.psUIAction.psSysImage.imagePath}} imgPath: "{{item.psUIAction.psSysImage.imagePath}}",{{/if}}{{#if item.psUIAction.psSysImage.cssClass}} iconClass: "{{item.psUIAction.psSysImage.cssClass}}",{{/if}}{{/if}} },
{{/if}}
{{#if (and (eq item.detailType "GROUPPANEL") item.psUIActionGroup)}}
uIActionGroup: {
......@@ -57,7 +50,7 @@
caption: '{{item.psUIActionGroup.name}}',
details: [
{{#each item.psUIActionGroup.psUIActionGroupDetails as | detail | }}
{ caption: '{{detail.psUIAction.caption}}', disabled: false, visible: true, uIActionTag: '{{detail.psUIAction.uIActionTag}}', showCaption: {{detail.showCaption}}, showIcon: {{detail.showIcon}}, {{#if detail.psUIAction.psSysImage}}{{#if detail.psUIAction.psSysImage.imagePath}} imgPath: "{{detail.psUIAction.psSysImage.imagePath}}",{{/if}}{{#if detail.psUIAction.psSysImage.cssClass}} iconClass: "{{detail.psUIAction.psSysImage.cssClass}}",{{/if}}{{/if}} },
{ caption: '{{detail.psUIAction.caption}}', uIActionMode: "{{detail.psUIAction.uIActionMode}}", disabled: false, visible: true, uIActionTag: '{{detail.psUIAction.uIActionTag}}', showCaption: {{detail.showCaption}}, showIcon: {{detail.showIcon}}, {{#if detail.psUIAction.psSysImage}}{{#if detail.psUIAction.psSysImage.imagePath}} imgPath: "{{detail.psUIAction.psSysImage.imagePath}}",{{/if}}{{#if detail.psUIAction.psSysImage.cssClass}} iconClass: "{{detail.psUIAction.psSysImage.cssClass}}",{{/if}}{{/if}} },
{{/each}}
],
},
......@@ -65,19 +58,7 @@
{{#if item.psDEFDGroupLogics}}
groupLogics: [
{{#each item.psDEFDGroupLogics as | groupLogic |}}
{
name: '{{groupLogic.name}}',
groupOP: '{{groupLogic.groupOP}}',
relatedDetailNames: '{{groupLogic.relatedDetailNames}}',
logicCat: '{{groupLogic.logicCat}}',
logicType: '{{groupLogic.logicType}}',
notMode: {{groupLogic.notMode}},
logics: [
{{#each groupLogic.psDEFDLogics as | logic |}}
{condOP: '{{logic.condOP}}',dEFDName: '{{logic.dEFDName}}',logicType: '{{logic.logicType}}',name: '{{logic.name}}',value:'{{logic.value}}'},
{{/each}}
],
},
{{> @macro/front-end/common/delogic.hbs logic=groupLogic}}
{{/each}}
],
{{/if}}
......
<AppFormGroup
name="{{item.codeName}}"
{{#if item.captionItemName}}
:title="state.data.{{lowerCase item.captionItemName}}"
{{else}}
title="{{item.caption}}"
{{/if}}
:visible="state.detailsModel.{{item.codeName}}.visible"
:layoutOpts="{{> @macro/front-end/common/layoutPos.hbs layout=item.psLayout layoutPos=item.psLayoutPos}}"
{{#if item.psSysCss}}
......
{{#neq item.psEditor.editorType "HIDDEN"}}
<AppFormItem
name="{{item.codeName}}"
{{#if item.captionItemName}}
:label="state.data.{{lowerCase item.captionItemName}}"
{{else}}
label="{{item.caption}}"
{{/if}}
{{#if item.labelPos}}
labelPos="{{item.labelPos}}"
{{/if}}
:labelWidth="{{item.labelWidth}}"
:showLabel="{{item.showCaption}}"
:rules="state.rules.{{item.codeName}}"
:required="state.detailsModel.{{item.codeName}}.required"
:visible="state.detailsModel.{{item.codeName}}.visible"
......
......@@ -2,7 +2,7 @@
name="{{item.codeName}}"
:visible="state.detailsModel.{{item.codeName}}.visible"
:layoutOpts="{{> @macro/front-end/common/layoutPos.hbs layout=item.psLayout layoutPos=item.psLayoutPos}}"
name={{item.name}}>
>
{{#each item.psDEFormPages as | formPage | }}
{{> @macro/front-end/widgets/form-detail/include-form.hbs type=formPage.detailType item=formPage}}
{{/each}}
......
<script setup lang="ts">
import { IActionParam, ILayoutOpts, IParam } from "@core";
import { IActionParam, ILayoutOpts, deepCopy } from "@core";
interface FormButtonProps{
name: string;
......@@ -9,22 +9,36 @@ interface FormButtonProps{
imgPath?: string;
showCaption?: boolean;
labelCssName?: string;
caption: string
caption: string,
uIAction: any;
}
const props = withDefaults(defineProps<FormButtonProps>(), {
visible: true,
showCaption: true,
});
interface FormButtonEmits {
(name: 'action', event: IActionParam): void
}
const emit = defineEmits<FormButtonEmits>();
// 点击
const click = (event: MouseEvent) => {
const data = deepCopy(props.uIAction);
Object.assign(data, { event: event });
emit('action', { tag: name, action: 'formButtonAction', data: data });
}
</script>
<template>
<AppCol :visible="visible" noRoot :layoutOpts="layoutOpts" class="app-formButton">
<AppCol :visible="visible" noRoot :layoutOpts="layoutOpts" class="app-form-button">
<template #default="{slotStyle, slotClass}">
<a-button
:class="slotClass"
:style="slotStyle"
type="primary">
type="primary"
@click="click">
<AppIconText :class="labelCssName" :iconClass="iconClass" :imgPath="imagePath" :text="showCaption ? caption : '' "/>
</a-button>
</template>
......
<script setup lang="ts">
import { Ref, ref } from 'vue';
import { IActionParam, ILayoutOpts } from '@core';
interface FormGroupProps {
......@@ -9,6 +10,7 @@ interface FormGroupProps {
required?: boolean;
visible?: boolean;
labelWidth?: number;
labelPos?: string | 'LEFT' | 'TOP' | 'RIGHT' | 'BOTTOM' | 'NONE';
rules?: any;
error?: string;
labelClass?: string;
......@@ -19,21 +21,29 @@ interface FormGroupEmit {
const props = withDefaults(defineProps<FormGroupProps>(), {
required: false,
visible: true,
showLabel: true
showLabel: true,
labelPos: 'LEFT'
});
const emit = defineEmits<FormGroupEmit>();
onBeforeMount(() => {
watch(
() => props.required,
(newVal: boolean, oldVal: boolean) => {
initRules();
}
)
initRules();
});
let itemRules: any = [];
const itemRules: Ref<any[]> = ref([]);
const initRules = () => {
itemRules.value.splice(0, itemRules.value.length);
if (props.rules) {
itemRules.push(...props.rules);
itemRules.value.push(...props.rules);
}
if (props.required) {
itemRules.push({
itemRules.value.push({
trigger: ['change', 'blur'],
required: props.required,
message: props.label + '必须填写',
......@@ -56,7 +66,7 @@ const initRules = () => {
:labelCol="{ style: { width: `${labelWidth}px` } }"
:validateStatus="error ? 'error' : 'validating'"
>
<template #label v-if="showLabel">
<template #label v-if="showLabel && labelPos !== 'NONE'">
<label :class="labelClass">
<div class="label-title">{{ label }}</div>
</label>
......
......@@ -97,7 +97,8 @@ const { handleEditorNavParams, loadCodeListData } = new EditorBase();
const { navContext, navViewParam } = handleEditorNavParams(props);
let text: Ref<string> = ref("");
let textFormat: Ref<string> = ref("");
onBeforeMount(() => {
// 初始化值
const initText = () => {
if (props.codeListTag) {
loadCodeListData(
props.codeListTag as string,
......@@ -110,11 +111,11 @@ onBeforeMount(() => {
if (item) {
text.value = item.label;
} else {
text.value = props.value;
text.value = props.value as string;
}
});
} else {
text.value = props.value;
text.value = props.value as string;
}
if (props.valueFormat) {
textFormat.value = props.valueFormat;
......@@ -128,6 +129,12 @@ onBeforeMount(() => {
} else if (Object.is(props.dataType, "NUMBER")) {
textFormat.value = `#${props.unitName}`;
}
}
onBeforeMount(() => {
// 监听值变化
watch(() => props.value, (newVal: any, oldVal: any) => { if (newVal !== oldVal) initText(); });
initText();
});
</script>
......
import { IParam, MainControlState } from '@core';
import { ControlVOBase, IParam, MainControlState } from '@core';
/**
* @description 表单部件状态
......@@ -9,25 +9,25 @@ import { IParam, MainControlState } from '@core';
export interface FormControlState extends MainControlState {
/**
* @description 表单数据对象
* @type {IParam}
* @description 新建默认值集合
* @type {IParam[]}
* @memberof FormControlState
*/
data: IParam;
createDefaultItems: IParam[];
/**
* @description 表单成员模型
* @description 表单数据对象
* @type {IParam}
* @memberof FormControlState
*/
detailsModel: IParam;
data: ControlVOBase;
/**
* @description 表单界面行为模型
* @description 表单成员模型
* @type {IParam}
* @memberof FormControlState
*/
actionModel: IParam;
detailsModel: IParam;
/**
* @description 值规则
......@@ -42,4 +42,11 @@ export interface FormControlState extends MainControlState {
* @memberof FormControlState
*/
enableAutoSave: boolean;
/**
* @description 更新默认值集合
* @type {IParam[]}
* @memberof FormControlState
*/
updateDefaultItems: IParam[];
}
......@@ -509,7 +509,7 @@ export class GridControl extends MDControl {
const { groupField } = gridGroup;
let autoGroup: string[] = [];
items.value.forEach((item: IParam) => {
if (item.hasOwnProperty(groupField)) {
if (item.hasKey(groupField)) {
autoGroup.push(item[groupField]);
}
})
......@@ -652,13 +652,13 @@ export class GridControl extends MDControl {
* @memberof GridControl
*/
protected setCreateDefault(row: IParam = {}): void {
const { createDefaultItems, viewParams, context, items } = this.state;
const { createDefaultItems, viewParams, context } = this.state;
if (createDefaultItems.length === 0) {
return;
}
createDefaultItems.forEach((item: IParam) => {
const { createDVT, createDV, property, valueFormat, fieldType } = item;
if (createDVT && (row.hasOwnProperty(property) || property in row)) {
const { createDVT, createDV, property, valueFormat, dataType } = item;
if (createDVT && row.hasKey(property)) {
switch (createDVT) {
case "CONTEXT":
if (createDV) {
......@@ -686,8 +686,8 @@ export class GridControl extends MDControl {
}
break;
}
} else if (createDV && (row.hasOwnProperty(property) || property in row)) {
row[property] = fieldType && DataTypes.isNumber(fieldType) ? Number(createDV) : createDV;
} else if (createDV && row.hasKey(property)) {
row[property] = dataType && DataTypes.isNumber(dataType) ? Number(createDV) : createDV;
}
});
}
......@@ -700,14 +700,14 @@ export class GridControl extends MDControl {
* @memberof GridControl
*/
protected setUpdateDefault(): void {
const { updateDefaultItems, viewParams, context, items, controlService } = this.state;
const { updateDefaultItems, viewParams, context, items } = this.state;
if (updateDefaultItems.length === 0 || items.length === 0) {
return;
}
const setDefault = (row: IParam = {}) => {
updateDefaultItems.forEach((item: IParam) => {
const { updateDV, updateDVT, property, valueFormat, fieldType } = item;
if (updateDVT && (row.hasOwnProperty(property) || property in row)) {
const { updateDV, updateDVT, property, valueFormat, dataType } = item;
if (updateDVT && row.hasKey(property)) {
switch (updateDVT) {
case "CONTEXT":
if (updateDV) {
......@@ -735,8 +735,8 @@ export class GridControl extends MDControl {
}
break;
}
} else if (updateDV && row.hasOwnProperty(property)) {
row[property] = fieldType && DataTypes.isNumber(fieldType) ? Number(updateDV) : updateDV;
} else if (updateDV && row.hasKey(property)) {
row[property] = dataType && DataTypes.isNumber(dataType) ? Number(updateDV) : updateDV;
}
});
}
......
import { IParam, MainControlState } from '@core';
import { ControlVOBase, IParam, MainControlState } from '@core';
/**
* @description 多数据部件状态
......@@ -20,7 +20,7 @@ export interface MDControlState extends MainControlState {
* @type {IParam[]}
* @memberof MDControlState
*/
items: IParam[];
items: ControlVOBase[];
/**
* @description 是否多选
......
import { deepCopy } from '@core';
import { deepCopy, IParam } from '@core';
export class ControlVOBase {
/**
* 后台数据对象
* @description 后台数据对象
* @protected
* @type {*}
* @memberof ControlVOBase
*/
protected $DO: any = {};
/**
* 自有属性名称集合
* @description 自有属性名称集合
* @type {string[]}
* @memberof ControlVOBase
*/
public $ownKeys: string[] = [];
......@@ -91,6 +95,19 @@ export class ControlVOBase {
return {};
}
/**
* @description 是否含有属性
* @param {string} key 属性名
* @return {*} {boolean}
* @memberof ControlVOBase
*/
public hasKey(key: string): boolean {
if (this.hasOwnProperty(key) || key in this) {
return true;
}
return false;
}
/**
* 用后台数据重置数据对象
* @param data 后台数据
......
......@@ -51,15 +51,56 @@ export const ctrlState = {
controlName: '{{ctrl.name}}',
controlService: new EditFormService<ControlVO>(ControlVO, new {{pascalCase ctrl.psAppDataEntity.codeName}}Service() ),
data: new ControlVO({}),
{{#each ctrl.psAppDataEntity.allPSAppDEFields as | appDEField | }}
{{#if appDEField.keyField}}
appDeKeyFieldName: '{{appDEField.codeName}}',
appEntityCodeName: '{{ctrl.appEntity.codeName}}',
appDeCodeName:'{{ctrl.appEntity.codeName}}',
appDeLogicName: '{{ctrl.appEntity.logicName}}',
appDeKeyFieldName: '{{#if ctrl.appEntity.keyPSAppDEField}}{{ctrl.appEntity.keyPSAppDEField.codeName}}{{/if}}',
appDeMajorFieldName: '{{#if ctrl.appEntity.majorPSAppDEField}}{{ctrl.appEntity.majorPSAppDEField.codeName}}{{/if}}',
enableAutoSave: {{ctrl.enableAutoSave}},
// 新建默认值
createDefaultItems: [
{{#each ctrl.psDEFormItems as | formItem |}}
{{#formItem}}
{{#if (or createDV createDVT)}}
{
createDV: "{{createDV}}",
createDVT: "{{createDVT}}",
property: "{{lowerCase id}}",
{{#if (and psEditor psEditor.dateTimeFormat)}}
valueFormat: "{{editItem.psEditor.dateTimeFormat}}",
{{else if psAppDEField}}
valueFormat: "{{psAppDEField.valueFormat}}",
{{/if}}
{{#if psAppDEField}}
dataType: "{{psAppDEField.stdDataType}}"
{{/if}}
{{#if appDEField.majorField}}
appDeMajorFieldName: '{{appDEField.codeName}}',
}{{#unless @last}},{{/unless}}
{{/if}}
{{/formItem}}
{{/each}}
enableAutoSave: {{ctrl.enableAutoSave}},
],
// 更新默认值
updateDefaultItems: [
{{#each ctrl.psDEFormItems as | formItem |}}
{{#formItem}}
{{#if (or updateDV updateDVT)}}
{
updateDV: "{{updateDV}}",
updateDVT: "{{updateDVT}}",
property: "{{lowerCase id}}",
{{#if (and psEditor psEditor.dateTimeFormat)}}
valueFormat: "{{editItem.psEditor.dateTimeFormat}}",
{{else if psAppDEField}}
valueFormat: "{{psAppDEField.valueFormat}}",
{{/if}}
{{#if psAppDEField}}
dataType: "{{psAppDEField.stdDataType}}"
{{/if}}
}{{#unless @last}},{{/unless}}
{{/if}}
{{/formItem}}
{{/each}}
],
detailsModel: {
{{#if ctrl.psDEFormPages}}
{{#each ctrl.psDEFormPages as | FormPage | }}
......
......@@ -48,7 +48,7 @@ export const ctrlState = {
valueFormat: "{{editItem.psAppDEField.valueFormat}}",
{{/if}}
{{#if editItem.psAppDEField}}
fieldType: "{{editItem.psAppDEField.stdDataType}}"
dataType: "{{editItem.psAppDEField.stdDataType}}"
{{/if}}
}{{#unless @last}},{{/unless}}
{{/if}}
......@@ -180,7 +180,7 @@ export const ctrlState = {
valueFormat: "{{editItem.psAppDEField.valueFormat}}",
{{/if}}
{{#if editItem.psAppDEField}}
fieldType: "{{editItem.psAppDEField.stdDataType}}"
dataType: "{{editItem.psAppDEField.stdDataType}}"
{{/if}}
}{{#unless @last}},{{/unless}}
{{/if}}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册