提交 3cb85367 编写于 作者: WodahsOrez's avatar WodahsOrez

update: 表单布局

上级 7468d06a
{
{{~#if layout}}
{{~#if layout.layout~}}
selfLayout: '{{layout.layout}}',
{{~/if~}}
{{~#if layout.dir~}}
dir: '{{layout.dir}}',
{{/if~}}
{{~#if layout.align~}}
align: '{{layout.align}}',
{{~/if~}}
{{~#if layout.vAlign~}}
vAlign: '{{layout.vAlign}}',
{{~/if~}}
{{~/if~}}
{{~#if layoutPos~}}
{{~#if layoutPos.layout~}}
parentLayout: '{{layoutPos.layout}}',
{{~/if~}}
{{~#if layoutPos.grow~}}
grow: {{layoutPos.grow}},
{{~/if~}}
{{~#if (and layoutPos.colLG (neq layoutPos.colLG -1) )~}}
colLG: {{layoutPos.colLG}},
{{~/if~}}
{{~#if (and layoutPos.colLGOffset (neq layoutPos.colLGOffset -1) )~}}
colLGOffset: {{layoutPos.colLGOffset}},
{{~/if~}}
{{~#if (and layoutPos.colMD (neq layoutPos.colMD -1) )~}}
colMD: {{layoutPos.colMD}},
{{~/if~}}
{{~#if (and layoutPos.colMDOffset (neq layoutPos.colMDOffset -1) )~}}
colMDOffset: {{layoutPos.colMDOffset}},
{{~/if~}}
{{~#if (and layoutPos.colSM (neq layoutPos.colSM -1) )~}}
colSM: {{layoutPos.colSM}},
{{~/if~}}
{{~#if (and layoutPos.colSMOffset (neq layoutPos.colSMOffset -1) )~}}
colSMOffset: {{layoutPos.colSMOffset}},
{{~/if~}}
{{~#if (and layoutPos.colXS (neq layoutPos.colXS -1) )~}}
colXS: {{layoutPos.colXS}},
{{~/if~}}
{{~#if (and layoutPos.colXSOffset (neq layoutPos.colXSOffset -1) )~}}
colXSOffset: {{layoutPos.colXSOffset}},
{{~/if~}}
{{/if}}
}
\ No newline at end of file
{{#eq item.psLayoutPos 'FLEX'}} <AppFormButton
<div style="flex-grow: {{#if item.psLayoutPos.grow}}{{item.psLayoutPos.grow}}{{else}}0{{/if}};"> name="{{item.codeName}}"
<AppFormButton :layoutOpts="{{> @macro/front-end/common/layoutPos.hbs layout=formDetail.psLayout layoutPos=formDetail.psLayoutPos}}"
:visible="state.detailsModel.{{item.codeName}}.visible" :visible="state.detailsModel.{{item.codeName}}.visible"
class="app-form-button{{#if item.psSysCss}} {{item.psSysCss.cssName}}{{/if}}" {{#if item.psSysCss}}
class="{{item.psSysCss.cssName}}"
{{/if}}
{{#if (or item.width item.height)}}
style="{{#if item.width}}width: {{item.width}}px;{{/if}}{{#if item.height}}height: {{item.height}}px;{{/if}}" style="{{#if item.width}}width: {{item.width}}px;{{/if}}{{#if item.height}}height: {{item.height}}px;{{/if}}"
cssClass="{{#if item.psSysImage.cssClass}}{{item.psSysImage.cssClass}}{{else}}''{{/if}}" {{/if}}
imagePath="{{#if item.psSysImage.imagePath}}{{item.psSysImage.imagePath}}{{else}}''{{/if}}" {{#if item.psSysImage.cssClass}}
iconClass="{{item.psSysImage.cssClass}}"
{{/if}}
{{#if item.psSysImage.imagePath}}
imgPath="{{item.psSysImage.imagePath}}"
{{/if}}
:showCaption="{{item.showCaption}}" :showCaption="{{item.showCaption}}"
labelCssName="{{#if item.labelPSSysCss}}{{item.labelPSSysCss.cssName}}{{/if}}" {{#if item.labelPSSysCss}}
caption="{{#if item.caption}}{{item.caption}}{{/if}}" labelCssName="{{item.labelPSSysCss.cssName}}"
/> {{/if}}
</div> {{#if item.caption}}
{{else}} caption="{{item.caption}}"
<a-col {{/if}}
{{> @macro/front-end/widgets/common/layout-pos.hbs item=item.psLayoutPos}} > />
<AppFormButton \ No newline at end of file
:visible="state.detailsModel.{{item.codeName}}.visible"
class="app-form-button{{#if item.psSysCss}} {{item.psSysCss.cssName}}{{/if}}"
style="{{#if item.width}}width: {{item.width}}px;{{/if}}{{#if item.height}}height: {{item.height}}px;{{/if}}"
cssClass="{{#if item.psSysImage.cssClass}}{{item.psSysImage.cssClass}}{{else}}''{{/if}}"
imagePath="{{#if item.psSysImage.imagePath}}{{item.psSysImage.imagePath}}{{else}}''{{/if}}"
:showCaption="{{item.showCaption}}"
labelCssName="{{#if item.labelPSSysCss}}{{item.labelPSSysCss.cssName}}{{/if}}"
caption="{{#if item.caption}}{{item.caption}}{{/if}}"
/>
</a-col>
{{/eq}}
\ No newline at end of file
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
relatedDetailNames: '{{groupLogic.relatedDetailNames}}', relatedDetailNames: '{{groupLogic.relatedDetailNames}}',
logicCat: '{{groupLogic.logicCat}}', logicCat: '{{groupLogic.logicCat}}',
logicType: '{{groupLogic.logicType}}', logicType: '{{groupLogic.logicType}}',
notMode: '{{groupLogic.notMode}}', notMode: {{groupLogic.notMode}},
logics: [ logics: [
{{#each groupLogic.psDEFDLogics as | logic |}} {{#each groupLogic.psDEFDLogics as | logic |}}
{condOP: '{{logic.condOP}}',dEFDName: '{{logic.dEFDName}}',logicType: '{{logic.logicType}}',name: '{{logic.name}}',value:'{{logic.value}}'}, {condOP: '{{logic.condOP}}',dEFDName: '{{logic.dEFDName}}',logicType: '{{logic.logicType}}',name: '{{logic.name}}',value:'{{logic.value}}'},
......
{{#eq item.psLayoutPos 'FLEX'}} <AppFormDruipart
<div style="flex-grow: {{#if item.psLayoutPos.grow}}{{item.psLayoutPos.grow}}{{else}}0{{/if}};">
<AppFormDruipart
v-show="state.detailsModel.{{item.codeName}}.visible"
{{#if item.psSysCss}}class="{{item.psSysCss.cssName}}"{{/if}}
style="{{#if item.width}}width: {{item.width}}px;{{/if}}{{#if item.height}}height: {{item.height}}px{{/if}}"
name="{{item.codeName}}" name="{{item.codeName}}"
title="{{item.caption}}" title="{{item.caption}}"
:visible="state.detailsModel.{{item.codeName}}.visible"
:layoutOpts="{{> @macro/front-end/common/layoutPos.hbs layout=formDetail.psLayout layoutPos=formDetail.psLayoutPos}}"
{{#if item.psSysCss}}
class="{{item.psSysCss.cssName}}"
{{/if}}
{{#if (or item.width item.height)}}
style="{{#if item.width}}width: {{item.width}}px;{{/if}}{{#if item.height}}height: {{item.height}}px;{{/if}}"
{{/if}}
:context="context" :context="context"
:viewParams="viewParams" :viewParams="viewParams"
:data="state.data" :data="state.data"
:viewSubject="state.viewSubject" :viewSubject="state.viewSubject">
v-slot="druipartParams"> <template #default="druipartParams">
<{{item.psAppView.codeName}} <{{item.psAppView.codeName}}
:class="['app-view-layout--from-druipart']" :class="['app-view-layout--from-druipart']"
:context="druipartParams.context" :context="druipartParams.context"
...@@ -20,31 +23,5 @@ ...@@ -20,31 +23,5 @@
@viewEvent="druipartParams.viewEvent" @viewEvent="druipartParams.viewEvent"
> >
</{{item.psAppView.codeName}}> </{{item.psAppView.codeName}}>
</AppFormDruipart> </template>
</div> </AppFormDruipart>
{{else}} \ No newline at end of file
<a-col
{{> @macro/front-end/widgets/common/layout-pos.hbs item=item.psLayoutPos}} >
<AppFormDruipart
v-show="state.detailsModel.{{item.codeName}}.visible"
{{#if item.psSysCss}}class="{{item.psSysCss.cssName}}"{{/if}}
style="{{#if item.width}}width: {{item.width}}px;{{/if}}{{#if item.height}}height: {{item.height}}px{{/if}}"
name="{{item.codeName}}"
title="{{item.caption}}"
:context="context"
:viewParams="viewParams"
:data="state.data"
:viewSubject="state.viewSubject"
v-slot="druipartParams">
<{{item.psAppView.codeName}}
:class="['app-view-layout--from-druipart']"
:context="druipartParams.context"
:viewParams="druipartParams.viewParams"
:viewDefaultUsage="false"
:noViewCaption="true"
@viewEvent="druipartParams.viewEvent"
>
</{{item.psAppView.codeName}}>
</AppFormDruipart>
</a-col>
{{/eq}}
\ No newline at end of file
{{#eq item.psLayoutPos 'FLEX'}} <AppFormGroup
<div style="flex-grow: {{#if item.psLayoutPos.grow}}{{item.psLayoutPos.grow}}{{else}}0{{/if}};">
<AppFormGroup
v-show="state.detailsModel.{{item.codeName}}.visible"
name="{{item.codeName}}" name="{{item.codeName}}"
title="{{item.caption}}" title="{{item.caption}}"
{{#if item.psSysCss}} :visible="state.detailsModel.{{item.codeName}}.visible"
:layoutOpts="{{> @macro/front-end/common/layoutPos.hbs layout=formDetail.psLayout layoutPos=formDetail.psLayoutPos}}"
{{#if item.psSysCss}}
class="{{item.psSysCss.cssName}}" class="{{item.psSysCss.cssName}}"
{{/if}} {{/if}}
style="{{#if item.width}}width: {{item.width}}px;{{/if}}{{#if item.height}}height: {{item.height}}px{{/if}}" {{#if item.labelPSSysCss}}
{{#if item.psSysImage}} titleClass="{{item.labelPSSysCss.cssName}}"
{{/if}}
{{#if (or item.width item.height)}}
style="{{#if item.width}}width: {{item.width}}px;{{/if}}{{#if item.height}}height: {{item.height}}px;{{/if}}"
{{/if}}
{{#if item.psSysImage}}
{{#if item.psSysImage.imagePath}}imgPath="{{item.psSysImage.imagePath}}"{{else if item.psSysImage.cssClass}}iconClass="{{item.psSysImage.cssClass}}"{{/if}} {{#if item.psSysImage.imagePath}}imgPath="{{item.psSysImage.imagePath}}"{{else if item.psSysImage.cssClass}}iconClass="{{item.psSysImage.cssClass}}"{{/if}}
{{/if}} {{/if}}
{{#if item.labelPSSysCss}}
titleStyle="{{item.labelPSSysCss.cssName}}"
{{/if}}
:infoGroupMode="{{item.infoGroupMode}}" :infoGroupMode="{{item.infoGroupMode}}"
:titleBarCloseMode="{{item.titleBarCloseMode}}" :titleBarCloseMode="{{item.titleBarCloseMode}}"
:showCaption="{{item.showCaption}}" :showCaption="{{item.showCaption}}"
:uIActionGroup="state.detailsModel.{{item.codeName}}.uIActionGroup" :uIActionGroup="state.detailsModel.{{item.codeName}}.uIActionGroup"
@componentEvent="onComponentEvent"> @componentEvent="onComponentEvent">
{{#eq item.psLayout.layout "FLEX"}}
<div class="app-form-layout-flex" style="display: flex;{{#if item.psLayout.dir}}flex-direction: {{item.psLayout.dir}};{{/if}}{{#if item.psLayout.align}}justify-content: {{item.psLayout.align}};{{/if}}{{#if item.psLayout.vAlign}}align-items: {{item.psLayout.vAlign}};{{/if}}">
{{#each item.psDEFormDetails as | formDetail |}} {{#each item.psDEFormDetails as | formDetail |}}
{{>(lookup . 'formDetail.detailType') item=formDetail}} {{>(lookup . 'formDetail.detailType') item=formDetail}}
{{/each}} {{/each}}
</div> </AppFormGroup>
{{else}}
<a-row>
{{#each item.psDEFormDetails as | formDetail |}}
{{>(lookup . 'formDetail.detailType') item=formDetail}}
{{/each}}
</a-row>
{{/eq}}
</AppFormGroup>
</div>
{{else}}
<a-col
{{> @macro/front-end/widgets/common/layout-pos.hbs item=item.psLayoutPos}} >
<AppFormGroup
v-show="state.detailsModel.{{item.codeName}}.visible"
name="{{item.codeName}}"
title="{{item.caption}}"
{{#if item.psSysCss}}
class="{{item.psSysCss.cssName}}"
{{/if}}
style="{{#if item.width}}width: {{item.width}}px;{{/if}}{{#if item.height}}height: {{item.height}}px{{/if}}"
{{#if item.psSysImage}}
{{#if item.psSysImage.imagePath}}imgPath="{{item.psSysImage.imagePath}}"{{else if item.psSysImage.cssClass}}iconClass="{{item.psSysImage.cssClass}}"{{/if}}
{{/if}}
{{#if item.labelPSSysCss}}
titleStyle="{{item.labelPSSysCss.cssName}}"
{{/if}}
:infoGroupMode="{{item.infoGroupMode}}"
:titleBarCloseMode="{{item.titleBarCloseMode}}"
:showCaption="{{item.showCaption}}"
:uIActionGroup="state.detailsModel.{{item.codeName}}.uIActionGroup"
@componentEvent="onComponentEvent">
{{#eq item.psLayout.layout "FLEX"}}
<div class="app-form-layout-flex" style="display: flex;{{#if item.psLayout.dir}}flex-direction: {{item.psLayout.dir}};{{/if}}{{#if item.psLayout.align}}justify-content: {{item.psLayout.align}};{{/if}}{{#if item.psLayout.vAlign}}align-items: {{item.psLayout.vAlign}};{{/if}}">
{{#each item.psDEFormDetails as | formDetail |}}
{{>(lookup . 'formDetail.detailType') item=formDetail}}
{{/each}}
</div>
{{else}}
<a-row>
{{#each item.psDEFormDetails as | formDetail |}}
{{>(lookup . 'formDetail.detailType') item=formDetail}}
{{/each}}
</a-row>
{{/eq}}
</AppFormGroup>
</a-col>
{{/eq}}
\ No newline at end of file
{{#eq item.psLayoutPos 'FLEX'}} <AppFormIframe
<div style="flex-grow: {{#if item.psLayoutPos.grow}}{{item.psLayoutPos.grow}}{{else}}0{{/if}};"> name="{{item.codeName}}"
<AppFormIframe
:visible="state.detailsModel.{{item.codeName}}.visible" :visible="state.detailsModel.{{item.codeName}}.visible"
class="app-form-iframe{{#if item.psSysCss}} {{item.psSysCss.cssName}}{{/if}}" :layoutOpts="{{> @macro/front-end/common/layoutPos.hbs layout=formDetail.psLayout layoutPos=formDetail.psLayoutPos}}"
style="{{#if item.contentHeight}}height: {{item.contentHeight}}px;{{/if}}{{#if item.contentWidth}}width: {{item.contentWidth}}px{{/if}}" {{#if item.psSysCss}}
class="{{item.psSysCss.cssName}}"
{{/if}}
{{#if (or item.contentHeight item.contentWidth)}}
style="{{#if item.contentHeight}}height: {{item.contentHeight}}px;{{/if}}{{#if item.contentWidth}}width: {{item.contentWidth}}px;{{/if}}"
{{/if}}
iFrameUrl="{{item.iFrameUrl}}" iFrameUrl="{{item.iFrameUrl}}"
/> />
</div> \ No newline at end of file
{{else}}
<a-col
{{> @macro/front-end/widgets/common/layout-pos.hbs item=item.psLayoutPos}} >
<AppFormIframe
:visible="state.detailsModel.{{item.codeName}}.visible"
class="app-form-iframe{{#if item.psSysCss}} {{item.psSysCss.cssName}}{{/if}}"
style="{{#if item.contentHeight}}height: {{item.contentHeight}}px;{{/if}}{{#if item.contentWidth}}width: {{item.contentWidth}}px{{/if}}"
iFrameUrl="{{item.iFrameUrl}}"
/>
</a-col>
{{/eq}}
\ No newline at end of file
{{>@macro/front-end/editors/include-editor.hbs}} {{>@macro/front-end/editors/include-editor.hbs}}
{{#neq item.psEditor.editorType "HIDDEN"}} {{#neq item.psEditor.editorType "HIDDEN"}}
{{#eq item.psLayoutPos 'FLEX'}}
<div style="flex-grow: {{#if item.psLayoutPos.grow}}{{item.psLayoutPos.grow}}{{else}}0{{/if}};">
<AppFormItem <AppFormItem
v-show="state.detailsModel.{{item.codeName}}.visible"
{{#if item.psSysCss}}
class="{{item.psSysCss.cssName}}"
{{/if}}
{{#if item.labelPSSysCss}}
titleStyle="{{item.labelPSSysCss.cssName}}"
{{/if}}
name="{{item.codeName}}" name="{{item.codeName}}"
:rules="state.rules.{{item.codeName}}"
:labelWidth="{{item.labelWidth}}"
:required="state.detailsModel.{{item.codeName}}.required"
label="{{item.caption}}" label="{{item.caption}}"
style="{{#if item.width}}width: {{item.width}}px;{{/if}}{{#if item.height}}height: {{item.height}}px{{/if}}">
{{#if item.psEditor}}
<div class="form-editor-container" style="{{#if item.editorWidth}}width: {{item.editorWidth}}px;{{/if}}{{#if item.editorHeight}}height: {{item.editorHeight}}px{{/if}}">
{{>(lookup . 'item.psEditor.editorType') item=item ctrlType="form"}}
</div>
{{/if}}
</AppFormItem>
</div>
{{else}}
<a-col
{{> @macro/front-end/widgets/common/layout-pos.hbs item=item.psLayoutPos}} >
<AppFormItem
v-show="state.detailsModel.{{item.codeName}}.visible"
{{#if item.psSysCss}}
class="{{item.psSysCss.cssName}}"
{{/if}}
{{#if item.labelPSSysCss}}
titleStyle="{{item.labelPSSysCss.cssName}}"
{{/if}}
name="{{item.codeName}}"
:rules="state.rules.{{item.codeName}}"
:labelWidth="{{item.labelWidth}}" :labelWidth="{{item.labelWidth}}"
:rules="state.rules.{{item.codeName}}"
:required="state.detailsModel.{{item.codeName}}.required" :required="state.detailsModel.{{item.codeName}}.required"
label="{{item.caption}}" :visible="state.detailsModel.{{item.codeName}}.visible"
style="{{#if item.width}}width: {{item.width}}px;{{/if}}{{#if item.height}}height: {{item.height}}px{{/if}}"> :layoutOpts="{{> @macro/front-end/common/layoutPos.hbs layout=formDetail.psLayout layoutPos=formDetail.psLayoutPos}}"
{{#if item.psEditor}} {{#if item.psSysCss}}
class="{{item.psSysCss.cssName}}"
{{/if}}
{{#if item.labelPSSysCss}}
labelClass="{{item.labelPSSysCss.cssName}}"
{{/if}}
{{#if (or item.width item.height)}}
style="{{#if item.width}}width: {{item.width}}px;{{/if}}{{#if item.height}}height: {{item.height}}px;{{/if}}"
{{/if}}
>
{{#if item.psEditor}}
<div class="form-editor-container" style="{{#if item.editorWidth}}width: {{item.editorWidth}}px;{{/if}}{{#if item.editorHeight}}height: {{item.editorHeight}}px{{/if}}"> <div class="form-editor-container" style="{{#if item.editorWidth}}width: {{item.editorWidth}}px;{{/if}}{{#if item.editorHeight}}height: {{item.editorHeight}}px{{/if}}">
{{>(lookup . 'item.psEditor.editorType') item=item ctrlType="form"}} {{>(lookup . 'item.psEditor.editorType') item=item ctrlType="form"}}
</div> </div>
{{/if}} {{/if}}
</AppFormItem> </AppFormItem>
</a-col>
{{/eq}}
{{/neq}} {{/neq}}
\ No newline at end of file
<AppFormPage <AppFormPage
name="{{item.codeName}}"
:layoutOpts="{{> @macro/front-end/common/layoutPos.hbs layout=item.psLayout layoutPos=item.psLayoutPos}}"
:visible="state.detailsModel.{{item.codeName}}.visible" :visible="state.detailsModel.{{item.codeName}}.visible"
{{#if item.psSysCss}} {{#if item.psSysCss}}
class="{{item.psSysCss.cssName}}" class="{{item.psSysCss.cssName}}"
{{/if}} {{/if}}
key="{{item.codeName}}" key="{{item.codeName}}"
{{#if item.psSysImage}} tab="{{#if item.caption}}{{item.caption}}{{/if}}"
cssClass="{{#if item.psSysImage.cssClass}}{{item.psSysImage.cssClass}}{{else}}''{{/if}}"
imagePath="{{#if item.psSysImage.imagePath}}{{item.psSysImage.imagePath}}{{else}}''{{/if}}"
{{/if}}
caption="{{#if item.caption}}{{item.caption}}{{/if}}"
> >
{{#eq item.psLayout.layout "FLEX"}} <template #tab>
<div class="app-form-layout-flex" style="display: flex;{{#if item.psLayout.dir}}flex-direction: {{item.psLayout.dir}};{{/if}}{{#if item.psLayout.align}}justify-content: {{item.psLayout.align}};{{/if}}{{#if item.psLayout.vAlign}}align-items: {{item.psLayout.vAlign}};{{/if}}"> <AppIconText {{#if item.labelPSSysCss}}class="{{item.labelPSSysCss.cssName}}" {{/if}}{{#if item.psSysImage}}{{#if item.psSysImage.cssClass}}iconClass="{{item.psSysImage.cssClass}}" {{/if}}{{#if item.psSysImage.imagePath}}imgPath="{{item.psSysImage.imagePath}}" {{/if}}{{/if}}text="{{item.caption}}"/>
</template>
{{#each item.psDEFormDetails as | formDetail |}} {{#each item.psDEFormDetails as | formDetail |}}
{{>(lookup . 'formDetail.detailType') item=formDetail}} {{>(lookup . 'formDetail.detailType') item=formDetail}}
{{/each}} {{/each}}
</div>
{{else}}
<a-row>
{{#each item.psDEFormDetails as | formDetail |}}
{{>(lookup . 'formDetail.detailType') item=formDetail}}
{{/each}}
</a-row>
{{/eq}}
</AppFormPage> </AppFormPage>
\ No newline at end of file
{{#eq item.psLayoutPos 'FLEX'}} <AppRaw
<div style="flex-grow: {{#if item.psLayoutPos.grow}}{{item.psLayoutPos.grow}}{{else}}0{{/if}};">
<AppRaw
name="{{item.codeName}}" name="{{item.codeName}}"
v-show="state.detailsModel.{{item.codeName}}.visible" :visible="state.detailsModel.{{item.codeName}}.visible"
{{#if item.psSysCss}} {{#if item.psSysCss}}
class="{{item.psSysCss.cssName}}" class="{{item.psSysCss.cssName}}"
{{/if}} {{/if}}
{{#if item.psSysImage}} {{#if item.psSysImage}}
{{#if item.psSysImage.cssClass}}iconClass="{{item.psSysImage.cssClass}}"{{/if}}{{#if item.psSysImage.imagePath}}imgPath="{{item.psSysImage.imagePath}}"{{/if}} {{#if item.psSysImage.cssClass}}iconClass="{{item.psSysImage.cssClass}}"{{/if}}{{#if item.psSysImage.imagePath}}imgPath="{{item.psSysImage.imagePath}}"{{/if}}
{{/if}} {{/if}}
contentType="{{item.contentType}}" contentType="{{item.contentType}}"
style="{{#if item.rawItemHeight}}height: {{item.rawItemHeight}}px;{{/if}}{{#if item.rawItemWidth}}width: {{item.rawItemWidth}}px{{/if}}" {{#if (or item.rawItemHeight item.rawItemWidth)}}
style="{{#if item.rawItemHeight}}height: {{item.rawItemHeight}}px;{{/if}}{{#if item.rawItemWidth}}width: {{item.rawItemWidth}}px;{{/if}}"
{{/if}}
{{#if (eq item.contentType 'RAW')}}value="{{item.rawContent}}"{{else if (eq item.contentType 'HTML')}}:value="`{{item.htmlContent}}`"{{/if}}/> {{#if (eq item.contentType 'RAW')}}value="{{item.rawContent}}"{{else if (eq item.contentType 'HTML')}}:value="`{{item.htmlContent}}`"{{/if}}/>
</div>
{{else}}
<a-col
{{> @macro/front-end/widgets/common/layout-pos.hbs item=item.psLayoutPos}} >
<AppRaw
name="{{item.codeName}}"
v-show="state.detailsModel.{{item.codeName}}.visible"
{{#if item.psSysCss}}
class="{{item.psSysCss.cssName}}"
{{/if}}
{{#if item.psSysImage}}
{{#if item.psSysImage.cssClass}}iconClass="{{item.psSysImage.cssClass}}"{{/if}}{{#if item.psSysImage.imagePath}}imgPath="{{item.psSysImage.imagePath}}"{{/if}}
{{/if}}
contentType="{{item.contentType}}"
style="{{#if item.rawItemHeight}}height: {{item.rawItemHeight}}px;{{/if}}{{#if item.rawItemWidth}}width: {{item.rawItemWidth}}px{{/if}}"
{{#if (eq item.contentType 'RAW')}}value="{{item.rawContent}}"{{else if (eq item.contentType 'HTML')}}:value="`{{item.htmlContent}}`"{{/if}}/>
</a-col>
{{/eq}}
<AppFormTabpage <AppFormTabpage
name="{{item.codeName}}"
:visible="state.detailsModel.{{item.codeName}}.visible" :visible="state.detailsModel.{{item.codeName}}.visible"
{{#if item.psSysCss}} :layoutOpts="{{> @macro/front-end/common/layoutPos.hbs layout=formDetail.psLayout layoutPos=formDetail.psLayoutPos}}"
{{#if item.psSysCss}}
class="{{item.psSysCss.cssName}}" class="{{item.psSysCss.cssName}}"
{{/if}} {{/if}}
key="{{item.codeName}}" key="{{item.codeName}}"
caption="{{#if item.caption}}{{item.caption}}{{/if}}" caption="{{#if item.caption}}{{item.caption}}{{/if}}"
> >
{{#eq item.psLayout.layout "FLEX"}}
<div class="app-form-layout-flex" style="display: flex;{{#if item.psLayout.dir}}flex-direction: {{item.psLayout.dir}};{{/if}}{{#if item.psLayout.align}}justify-content: {{item.psLayout.align}};{{/if}}{{#if item.psLayout.vAlign}}align-items: {{item.psLayout.vAlign}};{{/if}}">
{{#each item.psDEFormDetails as | formDetail |}} {{#each item.psDEFormDetails as | formDetail |}}
{{>(lookup . 'formDetail.detailType') item=formDetail}} {{>(lookup . 'formDetail.detailType') item=formDetail}}
{{/each}} {{/each}}
</div>
{{else}}
<a-row>
{{#each item.psDEFormDetails as | formDetail |}}
{{>(lookup . 'formDetail.detailType') item=formDetail}}
{{/each}}
</a-row>
{{/eq}}
</AppFormTabpage> </AppFormTabpage>
{{#eq item.psLayoutPos 'FLEX'}} <AppFormTabpanel
<div style="flex-grow: {{#if item.psLayoutPos.grow}}{{item.psLayoutPos.grow}}{{else}}0{{/if}};" {{#if item.psSysCss}}class="{{item.psSysCss.cssName}}"{{/if}}> :visible="state.detailsModel.{{item.codeName}}.visible"
<AppFormTabpanel> :layoutOpts="{{> @macro/front-end/common/layoutPos.hbs layout=formDetail.psLayout layoutPos=formDetail.psLayoutPos}}"
name={{item.name}}>
{{#each item.psDEFormPages as | formPage | }} {{#each item.psDEFormPages as | formPage | }}
{{>(lookup . 'formPage.detailType') item=formPage }} {{>(lookup . 'formPage.detailType') item=formPage }}
{{/each}} {{/each}}
</AppFormTabpanel> </AppFormTabpanel>
</div>
{{else}}
<a-col
{{> @macro/front-end/widgets/common/layout-pos.hbs item=item.psLayoutPos}} >
<AppFormTabpanel>
{{#each item.psDEFormPages as | formPage | }}
{{>(lookup . 'formPage.detailType') item=formPage }}
{{/each}}
</AppFormTabpanel>
</a-col>
{{/eq}}
<script setup lang="ts"> <script setup lang="ts">
import { ILayoutPos } from "@core"; import { ILayoutOpts, LayoutTool, styleObj2Str } from "@core";
import { isObject } from "qx-util";
interface AppColProps{ interface AppColProps {
layoutPos: ILayoutPos; layoutOpts?: ILayoutOpts,
noRoot?: boolean,
visible?: boolean,
} }
const props = withDefaults(defineProps<AppColProps>(), { const props = withDefaults(defineProps<AppColProps>(), {
noRoot: false,
visible: true,
});
// 使用布局逻辑获得响应式的layout对象
let layout: any = null;
if (props.layoutOpts) {
layout = LayoutTool.useLayout(toRef(props as any, "layoutOpts"));
}
// 插槽类名和插槽样式,只有不绘制根元素的时候需要传递给插槽
const attrs = useAttrs()
// 在template里写会丢失响应性,故封一个计算属性。
let slotStyle = computed(() => {
let result = '';
result += isObject(attrs.style ) ? styleObj2Str(attrs.style) : attrs.style;
console.log(attrs.style)
console.log(result)
if(layout?.value?.colStyle){
result += layout.value.colStyle;
}
result += props.visible == true ? "" : "display: none;";
return result;
}); });
// use通用的layout解析逻辑。 let slotClass = computed(()=>{
let result = '';
result += attrs.class;
if(props.layoutOpts?.parentLayout == 'FLEX' && props.noRoot){
result += " app-col app-col--flex";
}
return result;
})
const layoutMode = ""; // 计算是否需要绘制根元素(layoutOpts不存在或者flex模式下noRoot为true时不绘制根元素)
let hasRoot = computed(()=>{
return props.layoutOpts !== undefined &&
( props.layoutOpts.parentLayout !== 'FLEX' || !props.noRoot );
})
onMounted(() => {
console.log(props)
});
</script> </script>
<template> <template>
<div v-if="layoutMode == 'FLEX'" class="app-col"> <template v-if="!hasRoot">
<slot></slot> <!-- 没有根元素的直接输出插槽 -->
</div> <slot :slotStyle="slotStyle" :slotClass="slotClass"></slot>
<a-col v-else class="app-col"> </template>
<slot></slot> <div
</a-col> v-else-if="layoutOpts?.parentLayout == 'FLEX'"
v-show="visible"
:style="layout.colStyle"
class="app-col app-col--flex"
>
<slot slotStyle="" slotClass="" ></slot>
</div>
<a-col
v-else
v-show="visible"
:lg="layout.colGridOpts.lg"
:xs="layout.colGridOpts.md"
:md="layout.colGridOpts.md"
:sm="layout.colGridOpts.sm"
class="app-col app-col--grid"
>
<slot slotStyle="" slotClass=""></slot>
</a-col>
</template> </template>
<style lang="scss"> <style lang="scss">
</style> </style>
\ No newline at end of file
<script setup lang="ts"> <script setup lang="ts">
import { IActionParam, IParam } from "@core"; import { IActionParam, ILayoutOpts, IParam } from "@core";
interface FormButtonProps{ interface FormButtonProps{
visible: boolean; name: string;
cssClass?: string; layoutOpts: ILayoutOpts;
imagePath?: string; visible?: boolean;
iconClass?: string;
imgPath?: string;
showCaption?: boolean; showCaption?: boolean;
labelCssName?: string; labelCssName?: string;
caption: string caption: string
} }
const props = withDefaults(defineProps<FormButtonProps>(), { const props = withDefaults(defineProps<FormButtonProps>(), {
visible: true, visible: true,
showCaption: true,
}); });
</script> </script>
<template> <template>
<app-col :visible="visible" noRoot :layoutOpts="layoutOpts" class="app-formButton">
<template #default="{slotStyle, slotClass}">
<a-button <a-button
type="primary" :class="slotClass"
v-show="visible"> :style="slotStyle"
<template #icon v-if="cssClass || imagePath"> type="primary">
<AppIconText :iconClass="cssClass" :imgPath="imagePath"/> <AppIconText :class="labelCssName" :iconClass="iconClass" :imgPath="imagePath" :text="showCaption ? caption : '' "/>
</template>
<template v-if="showCaption && caption">
<span :class="labelCssName">{{caption}}</span>
</template>
</a-button> </a-button>
</template>
</app-col>
</template> </template>
<style lang="scss"> <style lang="scss">
......
<script setup lang="ts"> <script setup lang="ts">
import { IActionParam, IParam, RouteUtil } from '@core'; import { IActionParam, ILayoutOpts, IParam, RouteUtil } from '@core';
import { Subject, Subscription } from 'rxjs'; import { Subject, Subscription } from 'rxjs';
interface FormDruipartProps { interface FormDruipartProps {
// 名称
name: string;
// 布局配置项
layoutOpts: ILayoutOpts;
// 刷新关系项 // 刷新关系项
tempMode?: string; tempMode?: string;
// 禁止加载 // 禁止加载
...@@ -26,15 +30,17 @@ interface FormDruipartProps { ...@@ -26,15 +30,17 @@ interface FormDruipartProps {
viewSubject: Subject<any>; viewSubject: Subject<any>;
// 视图路由参数 // 视图路由参数
parameters?: any[]; parameters?: any[];
// 名称
name: string;
// 是否忽略表单项值变化 // 是否忽略表单项值变化
ignoreFieldValueChange?: boolean; ignoreFieldValueChange?: boolean;
// 是否显示
visible?: boolean;
} }
interface FormDruipartEmit { interface FormDruipartEmit {
(name: 'componentEvent', value: IActionParam): void; (name: 'componentEvent', value: IActionParam): void;
} }
const props = withDefaults(defineProps<FormDruipartProps>(), {}); const props = withDefaults(defineProps<FormDruipartProps>(), {
visible: true,
});
const emit = defineEmits<FormDruipartEmit>(); const emit = defineEmits<FormDruipartEmit>();
...@@ -115,7 +121,9 @@ const viewEvent = (action:any) => { ...@@ -115,7 +121,9 @@ const viewEvent = (action:any) => {
</script> </script>
<template> <template>
<a-card :class="['app-form-druipart', `app-form-druipart-${name}`]" :bordered="false"> <app-col noRoot :visible="visible" :layoutOpts="layoutOpts" :class="['app-form-druipart', `app-form-druipart-${name}`]">
<template #default="{slotStyle, slotClass}">
<a-card :class="slotClass" :style="slotStyle" :bordered="false">
<template #title> <template #title>
<p :class="['app-form-druipart-title']"> <p :class="['app-form-druipart-title']">
<AppIconText :text="title" /> <AppIconText :text="title" />
...@@ -123,6 +131,8 @@ const viewEvent = (action:any) => { ...@@ -123,6 +131,8 @@ const viewEvent = (action:any) => {
</template> </template>
<slot :context="druipartContext" :viewParams="druipartViewParams" :viewEvent="viewEvent" ></slot> <slot :context="druipartContext" :viewParams="druipartViewParams" :viewEvent="viewEvent" ></slot>
</a-card> </a-card>
</template>
</app-col>
</template> </template>
<style lang="scss"> <style lang="scss">
......
<script setup lang="ts"> <script setup lang="ts">
import { IActionParam, IParam } from "@core"; import { IActionParam, ILayoutOpts, IParam } from "@core";
interface FormGroupProps{ interface FormGroupProps {
name: string; name: string;
layoutOpts: ILayoutOpts;
title?: string; title?: string;
imgPath?: string; imgPath?: string;
iconClass?: string; iconClass?: string;
titleStyle?: string; titleClass?: string;
infoGroupMode?: boolean; infoGroupMode?: boolean;
titleBarCloseMode?: number; titleBarCloseMode?: number;
showCaption?: boolean; showCaption?: boolean;
visible?: boolean;
uIActionGroup?: IParam; uIActionGroup?: IParam;
} }
interface FormGroupEmit{ interface FormGroupEmit {
(name: 'componentEvent', value: IActionParam): void (name: 'componentEvent', value: IActionParam): void
} }
const props = withDefaults(defineProps<FormGroupProps>(), { const props = withDefaults(defineProps<FormGroupProps>(), {
infoGroupMode: false, infoGroupMode: false,
showCaption: true, showCaption: true,
visible: true,
titleBarCloseMode: 0, titleBarCloseMode: 0,
}); });
const emit = defineEmits<FormGroupEmit>(); const emit = defineEmits<FormGroupEmit>();
const handleGroupAction = (action: IParam) => { const handleGroupAction = (action: IParam) => {
emit('componentEvent', { tag: props.name, action: 'formGroupAction', data: action}); emit('componentEvent', { tag: props.name, action: 'formGroupAction', data: action });
} }
const handleMenuGroupAction = ($event: IParam) => { const handleMenuGroupAction = ($event: IParam) => {
if (props.uIActionGroup && props.uIActionGroup.details?.length > 0) { if (props.uIActionGroup && props.uIActionGroup.details?.length > 0) {
const details = props.uIActionGroup.details; const details = props.uIActionGroup.details;
const detail = details.find((action: IParam) => Object.is(action.uIActionTag, $event.key)); const detail = details.find((action: IParam) => Object.is(action.uIActionTag, $event.key));
emit('componentEvent', { tag: props.name, action: 'formGroupAction', data: detail}); emit('componentEvent', { tag: props.name, action: 'formGroupAction', data: detail });
} }
} }
</script> </script>
<template> <template>
<app-col :class="['app-form-group', `app-form-group-${name}`]"> <app-col
<a-card noRoot
:headStyle="titleStyle" :visible="visible"
:bordered="false"> :layoutOpts="layoutOpts"
:class="['app-form-group', `app-form-group-${name}`]"
>
<template #default="{ slotClass, slotStyle }">
<a-card :class="slotClass" :style="slotStyle" :headStyle="titleClass" :bordered="false">
<template v-if="showCaption" #title> <template v-if="showCaption" #title>
<p class="app-form-group-title"> <p class="app-form-group-title">
<AppIconText :iconClass="iconClass" :imgPath="imgPath" :text="title"/> <AppIconText :iconClass="iconClass" :imgPath="imgPath" :text="title" />
</p> </p>
</template> </template>
<template v-if="showCaption" #extra> <template v-if="showCaption" #extra>
<template v-if="uIActionGroup"> <template v-if="uIActionGroup">
<template v-if="Object.is(uIActionGroup.extractMode, 'ITEMS')"> <template v-if="Object.is(uIActionGroup.extractMode, 'ITEMS')">
<a-dropdown> <a-dropdown>
<a class="group-action" @click.prevent> <a class="group-action" @click.prevent>{{ uIActionGroup.caption }}</a>
{{uIActionGroup.caption}}
</a>
<template #overlay> <template #overlay>
<a-menu @click="handleMenuGroupAction"> <a-menu @click="handleMenuGroupAction">
<template v-for="(item, index) in uIActionGroup.details" :key="index"> <template v-for="(item, index) in uIActionGroup.details" :key="index">
<a-menu-item <a-menu-item
v-if="item.visible" v-if="item.visible"
:key="item.uIActionTag" :key="item.uIActionTag"
:disabled="item.disabled"> :disabled="item.disabled"
>
<AppIconText <AppIconText
:iconClass="item.showIcon && item.iconClass" :iconClass="item.showIcon && item.iconClass"
:imgPath="item.showIcon && item.imgPath" :imgPath="item.showIcon && item.imgPath"
:text="item.showCaption && item.caption"/> :text="item.showCaption && item.caption"
/>
</a-menu-item> </a-menu-item>
</template> </template>
</a-menu> </a-menu>
...@@ -74,27 +81,28 @@ const handleMenuGroupAction = ($event: IParam) => { ...@@ -74,27 +81,28 @@ const handleMenuGroupAction = ($event: IParam) => {
v-show="item.visible" v-show="item.visible"
type="link" type="link"
:disabled="item.disabled" :disabled="item.disabled"
@click="handleGroupAction(item)"> @click="handleGroupAction(item)"
>
<AppIconText <AppIconText
:iconClass="item.showIcon && item.iconClass" :iconClass="item.showIcon && item.iconClass"
:imgPath="item.showIcon && item.imgPath" :imgPath="item.showIcon && item.imgPath"
:text="item.showCaption && item.caption"/> :text="item.showCaption && item.caption"
/>
</a-button> </a-button>
</span> </span>
</template> </template>
</template> </template>
</template> </template>
<app-row> <app-row :layoutOpts="layoutOpts">
<slot></slot> <slot></slot>
</app-row> </app-row>
</a-card> </a-card>
</template>
</app-col> </app-col>
</template> </template>
<style lang="scss"> <style lang="scss">
.app-form-group { .app-form-group {
height: 100%;
width: 100%;
.ant-card-head { .ant-card-head {
text-align: left; text-align: left;
.app-form-group-title { .app-form-group-title {
......
<script setup lang="ts"> <script setup lang="ts">
import { IActionParam, IParam } from "@core"; import { IActionParam, ILayoutOpts, IParam } from "@core";
interface FormIframeProps{ interface FormIframeProps{
name: string;
layoutOpts: ILayoutOpts;
visible: boolean; visible: boolean;
iFrameUrl: string iFrameUrl: string
} }
...@@ -12,9 +14,9 @@ const props = withDefaults(defineProps<FormIframeProps>(), { ...@@ -12,9 +14,9 @@ const props = withDefaults(defineProps<FormIframeProps>(), {
</script> </script>
<template> <template>
<div v-show="visible"> <app-col class="app-formDruipart" :visible="visible" :layoutOpts="layoutOpts" v-show="visible">
<iframe :src="iFrameUrl" style="height: 100%;width: 100%;border: 0"></iframe> <iframe class="app-formDruipart__iframe" :src="iFrameUrl" style="height: 100%;width: 100%;border: 0"></iframe>
</div> </app-col>
</template> </template>
<style lang="scss"> <style lang="scss">
......
<script setup lang="ts"> <script setup lang="ts">
import { IActionParam } from '@core'; import { IActionParam, ILayoutOpts } from '@core';
interface FormGroupProps { interface FormGroupProps {
name: string; name: string;
layoutOpts?: ILayoutOpts;
label?: string; label?: string;
required?: boolean; required?: boolean;
visible?: boolean;
labelWidth?: number; labelWidth?: number;
rules?: any; rules?: any;
error?: string; error?: string;
titleStyle?: string; labelClass?: string;
} }
interface FormGroupEmit { interface FormGroupEmit {
(name: 'componentEvent', value: IActionParam): void; (name: 'componentEvent', value: IActionParam): void;
} }
const props = withDefaults(defineProps<FormGroupProps>(), { const props = withDefaults(defineProps<FormGroupProps>(), {
required: false, required: false,
visible: true,
}); });
const emit = defineEmits<FormGroupEmit>(); const emit = defineEmits<FormGroupEmit>();
...@@ -39,22 +42,27 @@ const initRules = () => { ...@@ -39,22 +42,27 @@ const initRules = () => {
</script> </script>
<template> <template>
<app-col :visible="visible" noRoot :layoutOpts="layoutOpts" class="app-form-item">
<template v-slot:default="{slotStyle, slotClass}">
<a-form-item <a-form-item
:class="slotClass"
:style="slotStyle"
:name="name" :name="name"
:rules="itemRules" :rules="itemRules"
:help="error" :help="error"
:required="required" :required="required"
class="app-form-item"
:labelCol="{ style: { width: `${labelWidth}px` } }" :labelCol="{ style: { width: `${labelWidth}px` } }"
:validateStatus="error ? 'error' : 'validating'" :validateStatus="error ? 'error' : 'validating'"
> >
<template #label> <template #label>
<label :class="titleStyle"> <label :class="labelClass">
<div class="label-title">{{ label }}</div> <div class="label-title">{{ label }}</div>
</label> </label>
</template> </template>
<slot></slot> <slot></slot>
</a-form-item> </a-form-item>
</template>
</app-col>
</template> </template>
<style lang="scss"> <style lang="scss">
......
<script setup lang="ts"> <script setup lang="ts">
import { IActionParam, IParam } from "@core"; import { IActionParam, ILayoutOpts, IParam } from "@core";
interface FormPageProps{ interface FormPageProps {
visible: boolean; layoutOpts: ILayoutOpts;
cssClass?: string; tab?: string
imagePath?: string;
caption: string
} }
const props = withDefaults(defineProps<FormPageProps>(), { const props = withDefaults(defineProps<FormPageProps>(), {
visible: true,
}); });
</script> </script>
<template> <template>
<a-tab-pane v-show="visible"> <a-tab-pane class="app-formPage" :key="$attrs.key" :tab="tab">
<template #tab> <app-row :layoutOpts="layoutOpts">
<AppIconText :iconClass="cssClass" :imgPath="imagePath" :text="caption"/>
</template>
<slot></slot> <slot></slot>
</app-row>
</a-tab-pane> </a-tab-pane>
</template> </template>
......
<script setup lang="ts">
import { IActionParam, ILayoutOpts, IParam } from "@core";
interface FormRawProps{
name: string;
layoutOpts: ILayoutOpts;
visible?: boolean;
iconClass?: string;
imgPath?: string;
value?:any;
contentType?: string;
}
const props = withDefaults(defineProps<FormRawProps>(), {
visible: true,
});
</script>
<template>
<app-col :visible="visible" noRoot :layoutOpts="layoutOpts" class="app-formRaw">
<template #default="{slotStyle, slotClass}">
<AppRaw
:class="slotClass"
:style="slotStyle"
:iconClass="iconClass"
:value="value"
:contentType="contentType">
</AppRaw>
</template>
</app-col>
</template>
<style lang="scss">
</style>
\ No newline at end of file
<script setup lang="ts"> <script setup lang="ts">
import { IActionParam, IParam } from "@core"; import { IActionParam, ILayoutOpts, IParam } from "@core";
interface FormTabPageProps{ interface FormTabPageProps{
name: string;
layoutOpts: ILayoutOpts;
visible: boolean; visible: boolean;
caption: string caption: string
} }
...@@ -13,8 +15,10 @@ const props = withDefaults(defineProps<FormTabPageProps>(), { ...@@ -13,8 +15,10 @@ const props = withDefaults(defineProps<FormTabPageProps>(), {
</script> </script>
<template> <template>
<a-tab-pane v-show="visible" :tab="caption"> <a-tab-pane class="app-formTabPage" v-show="visible" :tab="caption">
<app-row :layoutOpts="layoutOpts">
<slot></slot> <slot></slot>
</app-row>
</a-tab-pane> </a-tab-pane>
</template> </template>
......
<script setup lang="ts">
import { IActionParam, ILayoutOpts, IParam } from "@core";
interface FormTabPanelProps {
name: string;
layoutOpts: ILayoutOpts;
visible?: boolean;
}
const props = withDefaults(defineProps<FormTabPanelProps>(), {
visible: true,
});
</script>
<template>
<app-col :visible="visible" noRoot :layoutOpts="layoutOpts" class="app-formTabPanel">
<template v-slot:default="{ slotStyle, slotClass }">
<a-tabs :class="slotClass" :style="slotStyle">
<slot></slot>
</a-tabs>
</template>
</app-col>
</template>
<style lang="scss">
</style>
\ No newline at end of file
<script setup lang="ts">
import { IActionParam, IParam } from "@core";
interface FormTabPanelProps{
}
const props = withDefaults(defineProps<FormTabPanelProps>(), {
});
</script>
<template>
<a-tabs class="app-form-page">
<slot></slot>
</a-tabs>
</template>
<style lang="scss">
</style>
\ No newline at end of file
<script setup lang="ts"> <script setup lang="ts">
import { ILayoutPos } from "@core"; import { ILayoutOpts } from "@core";
import { LayoutTool } from "@core/modules/common/layout-tool";
interface AppRowProps{ interface AppRowProps {
layoutPos: ILayoutPos; layoutOpts: ILayoutOpts;
} }
const props = withDefaults(defineProps<AppRowProps>(), { const props = withDefaults(defineProps<AppRowProps>(), {});
}); // 使用布局逻辑获得响应式的layout对象
const layout = LayoutTool.useLayout(toRef(props, "layoutOpts"));
// use通用的layout解析逻辑。
const layoutMode = "";
onMounted(() => {
console.log(props)
});
</script> </script>
<template> <template>
<div v-if="layoutMode == 'FLEX'" class="app-row"> <div
:style="layout.rowStyle"
v-if="layoutOpts.selfLayout == 'FLEX'" class="app-row app-row--flex">
<slot></slot> <slot></slot>
</div> </div>
<a-row v-else class="app-row"> <a-row v-else class="app-row app-row--grid">
<slot></slot> <slot></slot>
</a-row> </a-row>
</template> </template>
<style lang="scss"> <style lang="scss">
.app-row{
width: 100%;
}
</style> </style>
\ No newline at end of file
...@@ -8,7 +8,7 @@ interface CheckboxListProps { ...@@ -8,7 +8,7 @@ interface CheckboxListProps {
* @type {*} * @type {*}
* @memberof CheckboxListProps * @memberof CheckboxListProps
*/ */
value: any; value?: any;
/** /**
* 属性名称 * 属性名称
......
...@@ -16,7 +16,7 @@ interface DataPickerViewProps { ...@@ -16,7 +16,7 @@ interface DataPickerViewProps {
/** /**
* @description 编辑器值 * @description 编辑器值
*/ */
value: any; value?: any;
/** /**
* @description 禁用 * @description 禁用
......
...@@ -16,7 +16,7 @@ interface DataPickerProps { ...@@ -16,7 +16,7 @@ interface DataPickerProps {
/** /**
* @description 编辑器值 * @description 编辑器值
*/ */
value: any; value?: any;
/** /**
* @description 禁用 * @description 禁用
......
...@@ -8,7 +8,7 @@ interface ListBoxProps { ...@@ -8,7 +8,7 @@ interface ListBoxProps {
* @type {*} * @type {*}
* @memberof ListBoxProps * @memberof ListBoxProps
*/ */
value: any; value?: any;
/** /**
* 属性名称 * 属性名称
......
...@@ -8,7 +8,7 @@ interface RadioGroupProps { ...@@ -8,7 +8,7 @@ interface RadioGroupProps {
* @type {*} * @type {*}
* @memberof AppCheckBox * @memberof AppCheckBox
*/ */
value: any; value?: any;
/** /**
* 属性名称 * 属性名称
......
...@@ -8,7 +8,7 @@ interface SpanProps { ...@@ -8,7 +8,7 @@ interface SpanProps {
* @type {*} * @type {*}
* @memberof AppSpan * @memberof AppSpan
*/ */
value: string; value?: string;
/** /**
* 传入表单数据 * 传入表单数据
......
type LayoutMode = 'FLEX' | 'TABLE_24COL' | 'TABLE_12COL';
/** /**
* 布局配置 * 布局配置
* *
* @export * @export
* @interface ILayoutPos * @interface ILayoutOpts
*/ */
export interface ILayoutPos{ export interface ILayoutOpts {
/**
* 自身的容器布局模式(容器才有)
*/
selfLayout?: LayoutMode;
/**
* 父容器的布局模式(作为子才有)
*/
parentLayout?: LayoutMode;
/**
* Flex横轴对齐方向
*/
align?: string | 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around';
/**
* Flex布局方向
*/
dir?: string | 'row' | 'row-reverse' | 'column' | 'column-reverse';
/**
* Flex纵轴对齐方向
*/
vAlign?: string | 'flex-start' | 'flex-end' | 'center' | 'baseline' | 'stretch';
/**
* Flex延伸
* @type {number}
*/
grow?: number;
/**
* 大型列宽
* @type {number}
* @default -1
*/
colLG?: number;
/**
* 大型偏移
* @type {number}
* @default -1
*/
colLGOffset?: number;
/**
* 中型列宽
* @type {number}
* @default -1
*/
colMD?: number;
/**
* 中型偏移
* @type {number}
* @default -1
*/
colMDOffset?: number;
/**
* 小型列宽
* @type {number}
* @default -1
*/
colSM?: number;
/**
* 小型偏移
* @type {number}
* @default -1
*/
colSMOffset?: number;
/**
* 固定列宽
* @type {number}
* @default -1
*/
colWidth?: number;
/**
* 超小列宽
* @type {number}
* @default -1
*/
colXS?: number;
/**
* 超小偏移
* @type {number}
* @default -1
*/
colXSOffset?: number;
} }
import { ILayoutOpts, notEmpty } from '@core';
import { isNumber } from 'qx-util';
import { Ref } from 'vue';
/**
* 布局逻辑工具类
*
* @export
* @class LayoutTool
*/
export class LayoutTool {
/**
* 获取flex布局样式(父容器)
*
* @static
* @param {*} layoutOpts 布局设置
* @returns {string}
* @memberof LayoutTool
*/
public static getRowFlexStyle(layoutOpts: ILayoutOpts): string {
if (layoutOpts?.selfLayout == 'FLEX') {
const { dir, align, vAlign } = layoutOpts;
let cssStyle: string = 'width: 100%; height: 100%; overflow: auto; display: flex;';
cssStyle += dir ? `flex-direction: ${dir};` : '';
cssStyle += align ? `justify-content: ${align};` : '';
cssStyle += vAlign ? `align-items: ${vAlign};` : '';
return cssStyle;
} else {
return '';
}
}
/**
* 获取flex布局样式2(子)
*
* @static
* @param {*} layoutOpts 布局位置
* @returns {string}
* @memberof LayoutTool
*/
public static getColFlexStyle(layoutOpts: ILayoutOpts): string {
if (layoutOpts?.parentLayout == 'FLEX' && notEmpty(layoutOpts.grow)) {
let grow = layoutOpts.grow! < 0 ? 0 : layoutOpts.grow;
return `flex-grow: ${grow};`;
}
return '';
}
/**
* 获取栅格布局参数
*
* @static
* @param {*} layoutOpts
* @memberof LayoutTool
*/
public static getGridOptions(layoutOpts: ILayoutOpts, isTurn24: boolean = true) {
if (layoutOpts.parentLayout != 'TABLE_24COL' && layoutOpts.parentLayout != 'TABLE_12COL') {
return;
}
let colLG = this.formatColSpan(layoutOpts.colLG, layoutOpts.parentLayout);
let colMD = this.formatColSpan(layoutOpts.colMD, layoutOpts.parentLayout);
let colSM = this.formatColSpan(layoutOpts.colSM, layoutOpts.parentLayout);
let colXS = this.formatColSpan(layoutOpts.colXS, layoutOpts.parentLayout);
let colLGOffset = isNumber(layoutOpts.colLGOffset) ? layoutOpts.colLGOffset : 0;
let colMDOffset = isNumber(layoutOpts.colMDOffset) ? layoutOpts.colMDOffset : 0;
let colSMOffset = isNumber(layoutOpts.colSMOffset) ? layoutOpts.colSMOffset : 0;
let colXSOffset = isNumber(layoutOpts.colXSOffset) ? layoutOpts.colXSOffset : 0;
let multiplier = 1;
if (isTurn24) {
multiplier = layoutOpts.parentLayout == 'TABLE_24COL' ? 1 : 2;
}
return {
xs: { span: colXS * multiplier, offset: colXSOffset! * multiplier },
sm: { span: colSM * multiplier, offset: colSMOffset! * multiplier },
md: { span: colMD * multiplier, offset: colMDOffset! * multiplier },
lg: { span: colLG * multiplier, offset: colLGOffset! * multiplier },
};
}
/**
* 格式化栅格的列宽,对超出范围值的作出修改或设置默认值
*
* @static
* @param {*} span 栅格列宽
* @param {string} layoutMode 栅格类型(TABLE_24COL,TABLE_12COL)
* @returns
* @memberof LayoutTool
*/
public static formatColSpan(span: any, layoutMode: string) {
let colDefault = layoutMode == 'TABLE_24COL' ? 24 : 12;
// 空值传默认值
if (!isNumber(span)) {
return colDefault;
}
// 小于0传默认值,大于默认值传默认值,其他传原值
if (span < 0 || span > colDefault) {
return colDefault;
} else {
return span;
}
}
/**
* 使用容器布局逻辑,获得如下返回值
* rowStyle flex布局时作为父容器的样式
* colStyle flex布局时作为子元素的样式
* colGridOpts 栅格布局时作为子元素的占位和偏移
*
* @static
* @param layoutOpts
* @return {*}
*/
public static useLayout(layoutOpts: Ref<ILayoutOpts>) {
// 创建新的ref对象
const layoutResult: Ref<{ rowStyle: string; colStyle: string; colGridOpts: any }> = ref({
rowStyle: '',
colStyle: '',
colGridOpts: {},
});
watch(
layoutOpts,
(newVal, oldVal) => {
layoutResult.value.rowStyle = this.getRowFlexStyle(newVal);
layoutResult.value.colStyle = this.getColFlexStyle(newVal);
layoutResult.value.colGridOpts = this.getGridOptions(newVal);
},
{
immediate: true,
deep: true,
},
);
return layoutResult;
}
}
import { clone } from "ramda"; import { clone } from 'ramda';
/** /**
* @description 克隆方法 * @description 克隆方法
...@@ -6,8 +6,8 @@ import { clone } from "ramda"; ...@@ -6,8 +6,8 @@ import { clone } from "ramda";
* @param {Record<any, any>} data * @param {Record<any, any>} data
* @return {*} {Record<any, any>} * @return {*} {Record<any, any>}
*/ */
export function deepCopy(data: Record<any, any>): Record<any, any>{ export function deepCopy(data: Record<any, any>): Record<any, any> {
return clone(data) return clone(data);
} }
/** /**
...@@ -17,7 +17,7 @@ export function deepCopy(data: Record<any, any>): Record<any, any>{ ...@@ -17,7 +17,7 @@ export function deepCopy(data: Record<any, any>): Record<any, any>{
* @param {*} SecondOBJ 源对象 * @param {*} SecondOBJ 源对象
* @return {*} * @return {*}
*/ */
export function deepObjectMerge(FirstOBJ: any, SecondOBJ: any) { export function deepObjectMerge(FirstOBJ: any, SecondOBJ: any) {
for (var key in SecondOBJ) { for (var key in SecondOBJ) {
FirstOBJ[key] = FirstOBJ[key] =
FirstOBJ[key] && FirstOBJ[key].toString() === '[object Object]' FirstOBJ[key] && FirstOBJ[key].toString() === '[object Object]'
...@@ -45,7 +45,7 @@ export function dateFormat(date: any, fmt: string = 'YYYY-MM-DD HH:mm:ss'): stri ...@@ -45,7 +45,7 @@ export function dateFormat(date: any, fmt: string = 'YYYY-MM-DD HH:mm:ss'): stri
'h+': date.getHours().toString(), // 时 'h+': date.getHours().toString(), // 时
'm+': date.getMinutes().toString(), // 分 'm+': date.getMinutes().toString(), // 分
's+': date.getSeconds().toString(), // 秒 's+': date.getSeconds().toString(), // 秒
'S+': date.getSeconds().toString() 'S+': date.getSeconds().toString(),
// 有其他格式化字符需求可以继续添加,必须转化成字符串 // 有其他格式化字符需求可以继续添加,必须转化成字符串
}; };
for (let k in opt) { for (let k in opt) {
...@@ -63,7 +63,7 @@ export function dateFormat(date: any, fmt: string = 'YYYY-MM-DD HH:mm:ss'): stri ...@@ -63,7 +63,7 @@ export function dateFormat(date: any, fmt: string = 'YYYY-MM-DD HH:mm:ss'): stri
* @param {*} arg * @param {*} arg
* @return {*} {boolean} * @return {*} {boolean}
*/ */
export function isExist(arg: any): boolean{ export function isExist(arg: any): boolean {
return arg !== undefined && arg !== null && arg === arg; return arg !== undefined && arg !== null && arg === arg;
} }
...@@ -83,7 +83,7 @@ export function isEmpty(value: any): boolean { ...@@ -83,7 +83,7 @@ export function isEmpty(value: any): boolean {
* @param {*} arg * @param {*} arg
* @return {*} {boolean} * @return {*} {boolean}
*/ */
export function notEmpty(arg: any): boolean{ export function notEmpty(arg: any): boolean {
return isExist(arg) && arg != ''; return isExist(arg) && arg != '';
} }
...@@ -93,7 +93,7 @@ export function notEmpty(arg: any): boolean{ ...@@ -93,7 +93,7 @@ export function notEmpty(arg: any): boolean{
* @param fnName 方法名 * @param fnName 方法名
* @return {*} * @return {*}
*/ */
export function hasFunction(arg: any, fnName: string): boolean{ export function hasFunction(arg: any, fnName: string): boolean {
return arg[fnName] && arg[fnName] instanceof Function; return arg[fnName] && arg[fnName] instanceof Function;
} }
...@@ -137,7 +137,7 @@ export function typeOf(obj: any): string { ...@@ -137,7 +137,7 @@ export function typeOf(obj: any): string {
* @param {*} value2 对比值 * @param {*} value2 对比值
* @return {*} {boolean} * @return {*} {boolean}
*/ */
export function verifyValue(value: any, op: any, value2: any): boolean { export function verifyValue(value: any, op: any, value2: any): boolean {
// 等于操作 // 等于操作
if (Object.is(op, 'EQ')) { if (Object.is(op, 'EQ')) {
const _value = `${value}`; const _value = `${value}`;
...@@ -338,17 +338,17 @@ function contains(value: any, value2: any): boolean { ...@@ -338,17 +338,17 @@ function contains(value: any, value2: any): boolean {
* 设置sessionStorage数据 * 设置sessionStorage数据
* *
*/ */
export const setSessionStorage: Function = (key: string, value: any) => { export const setSessionStorage: Function = (key: string, value: any) => {
if (!value) { if (!value) {
return; return;
} }
sessionStorage.setItem(key, JSON.stringify(value)); sessionStorage.setItem(key, JSON.stringify(value));
} };
/** /**
* 获取sessionStorage数据 * 获取sessionStorage数据
* *
*/ */
export const getSessionStorage: Function = (key: string) => { export const getSessionStorage: Function = (key: string) => {
if (!key) { if (!key) {
return null; return null;
...@@ -359,12 +359,12 @@ export const getSessionStorage: Function = (key: string) => { ...@@ -359,12 +359,12 @@ export const getSessionStorage: Function = (key: string) => {
} else { } else {
return value; return value;
} }
} };
/** /**
* 删除sessionStorage数据 * 删除sessionStorage数据
* *
*/ */
export const removeSessionStorage: Function = (key: string) => { export const removeSessionStorage: Function = (key: string) => {
if (!key) { if (!key) {
return; return;
...@@ -372,4 +372,16 @@ export const removeSessionStorage: Function = (key: string) => { ...@@ -372,4 +372,16 @@ export const removeSessionStorage: Function = (key: string) => {
if (sessionStorage.getItem(key)) { if (sessionStorage.getItem(key)) {
sessionStorage.removeItem(key); sessionStorage.removeItem(key);
} }
} };
\ No newline at end of file
/**
* style对象转换成字符串
*
*/
export const styleObj2Str: Function = (style: any) => {
let s = "";
for (let i in style) {
s += i + ':' + style[i]+";";
}
return s;
};
...@@ -9,7 +9,7 @@ export const ctrlState = { ...@@ -9,7 +9,7 @@ export const ctrlState = {
{{#if ctrl.psSysImage.cssClass}} {{#if ctrl.psSysImage.cssClass}}
iconcls: '{{ctrl.psSysImage.cssClass}}', iconcls: '{{ctrl.psSysImage.cssClass}}',
{{else if (ctrl.psSysImage.imagePath)}} {{else if (ctrl.psSysImage.imagePath)}}
imagePath: '{{ctrl.psSysImage.imagePath}}', imgPath: '{{ctrl.psSysImage.imagePath}}',
{{/if}} {{/if}}
{{/if}} {{/if}}
{{#if ctrl.psLayoutPos.height}} {{#if ctrl.psLayoutPos.height}}
...@@ -33,7 +33,7 @@ export const ctrlState = { ...@@ -33,7 +33,7 @@ export const ctrlState = {
showCaption:{{groupDetail.showCaption}}, showCaption:{{groupDetail.showCaption}},
actionName: '{{groupDetail.psUIAction.caption}}', actionName: '{{groupDetail.psUIAction.caption}}',
icon: '{{groupDetail.psUIAction.psSysImage.cssClass}}', icon: '{{groupDetail.psUIAction.psSysImage.cssClass}}',
imagePath: '{{groupDetail.psUIAction.psSysImage.imagePath}}', imgPath: '{{groupDetail.psUIAction.psSysImage.imagePath}}',
disabled: false, visabled: true, disabled: false, visabled: true,
dataAccessAction: {{#if groupDetail.psUIAction.dataAccessAction}}false{{else}}true{{/if}}, dataAccessAction: {{#if groupDetail.psUIAction.dataAccessAction}}false{{else}}true{{/if}},
getNoPrivDisplayMode: {{#if groupDetail.psUIAction.noPrivDisplayMode}}groupDetail.psUIAction.noPrivDisplayMode{{else}}6{{/if}}, getNoPrivDisplayMode: {{#if groupDetail.psUIAction.noPrivDisplayMode}}groupDetail.psUIAction.noPrivDisplayMode{{else}}6{{/if}},
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册