提交 c5774523 编写于 作者: sq3536's avatar sq3536

Merge remote-tracking branch 'origin/master'

package cn.ibizlab.codegen.model; package cn.ibizlab.codegen.model;
import cn.ibizlab.codegen.utils.Inflector;
import cn.ibizlab.codegen.utils.StringAdvUtils; import cn.ibizlab.codegen.utils.StringAdvUtils;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.Getter; import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
...@@ -23,6 +26,49 @@ public class AppEntityModel extends BaseModel{ ...@@ -23,6 +26,49 @@ public class AppEntityModel extends BaseModel{
this.setName(appDataEntity.getName()); this.setName(appDataEntity.getName());
this.setId(String.format("%1$s-%2$s",app.getCodeName(),appDataEntity.getCodeName())); this.setId(String.format("%1$s-%2$s",app.getCodeName(),appDataEntity.getCodeName()));
// 初始化应用实体资源数据
if(getAppDataEntity().getMinorPSAppDERSs() != null){
// 遍历多个主从关系
getAppDataEntity().getMinorPSAppDERSs().forEach(appDERS ->{
JSONObject appEntityResource = new JSONObject();
String majorCodeName = appDERS.getMajorPSAppDataEntity().getCodeName();
String minorCodeName = appDERS.getMinorPSAppDataEntity().getCodeName();
String path = String.format("%1$s/:%2$s?/%3$s/:%4$s?", Inflector.getInstance().pluralize(majorCodeName),majorCodeName,Inflector.getInstance().pluralize(minorCodeName),minorCodeName).toLowerCase();
appEntityResource.put("majorCodeName",majorCodeName.toLowerCase());
appEntityResource.put("curCodeName",minorCodeName.toLowerCase());
appEntityResource.put("path",path);
// 实体关系路径集合
List deResPaths = new JSONArray();
// 主关系路径节点
JSONObject majorResNode = new JSONObject();
majorResNode.put("pathName", Inflector.getInstance().pluralize(majorCodeName).toLowerCase());
majorResNode.put("parameterName", majorCodeName.toLowerCase());
deResPaths.add(majorResNode);
// 从关系路径节点
JSONObject minorResNode = new JSONObject();
minorResNode.put("pathName", Inflector.getInstance().pluralize(minorCodeName).toLowerCase());
minorResNode.put("parameterName", minorCodeName.toLowerCase());
deResPaths.add(minorResNode);
appEntityResource.put("deResPaths", deResPaths);
appEntityResources.add(appEntityResource);
});
}else{
// 没有主从关系,路径就只有自己本身一个
JSONObject appEntityResource = new JSONObject();
appEntityResource.put("curCodeName",appDataEntity.getCodeName().toLowerCase());
appEntityResource.put("path",String.format("%1$s/:%2$s?",Inflector.getInstance().pluralize(appDataEntity.getCodeName()),appDataEntity.getCodeName()).toLowerCase());
// 路由关系路径集合
List deResPaths = new JSONArray();
// 实体本身关系路径节点
JSONObject curResNode = new JSONObject();
curResNode.put("pathName", Inflector.getInstance().pluralize(appDataEntity.getCodeName()).toLowerCase());
curResNode.put("parameterName", appDataEntity.getCodeName().toLowerCase());
deResPaths.add(curResNode);
appEntityResource.put("deResPaths", deResPaths);
appEntityResource.put("deResPathsString", deResPaths.toString());
appEntityResources.add(appEntityResource);
}
} }
public IPSAppDataEntity getAppDataEntity() public IPSAppDataEntity getAppDataEntity()
...@@ -64,4 +110,10 @@ public class AppEntityModel extends BaseModel{ ...@@ -64,4 +110,10 @@ public class AppEntityModel extends BaseModel{
return ctrlsMap.values(); return ctrlsMap.values();
} }
/**
* 应用实体资源数据
*/
private List<JSONObject> appEntityResources =new ArrayList<>();
} }
...@@ -38,6 +38,7 @@ public class AppModel extends BaseModel{ ...@@ -38,6 +38,7 @@ public class AppModel extends BaseModel{
if(getApplication().getAllPSAppDataEntities()!=null) if(getApplication().getAllPSAppDataEntities()!=null)
{ {
getApplication().getAllPSAppDataEntities().forEach(appDataEntity ->{ getApplication().getAllPSAppDataEntities().forEach(appDataEntity ->{
if(appDataEntity.getMinorPSAppDERSs() != null){ if(appDataEntity.getMinorPSAppDERSs() != null){
appDataEntity.getMinorPSAppDERSs().forEach(appDERS ->{ appDataEntity.getMinorPSAppDERSs().forEach(appDERS ->{
JSONObject tempObj = new JSONObject(); JSONObject tempObj = new JSONObject();
...@@ -59,6 +60,7 @@ public class AppModel extends BaseModel{ ...@@ -59,6 +60,7 @@ public class AppModel extends BaseModel{
} }
}); });
} }
} }
......
<IbizAutoComplete <IbizAutoComplete
name="{{item.codeName}}" name="{{item.codeName}}"
:value="state.data.{{item.psEditor.name}}"
:data="state.data" :data="state.data"
{{#if item.valueItemName}} {{#if item.valueItemName}}
valueItem="{{item.valueItemName}}" valueItem="{{item.valueItemName}}"
...@@ -39,4 +38,12 @@ ...@@ -39,4 +38,12 @@
{{#eq item.psEditor.editorType "AC_FS_NOBUTTON"}} {{#eq item.psEditor.editorType "AC_FS_NOBUTTON"}}
:showButton="false" :showButton="false"
{{/eq}} {{/eq}}
@editorEvent="handleEditorEvent"/> {{#if (or (eq ctrlType 'form') (eq ctrlType 'panel'))}}
:value="state.data.{{item.psEditor.name}}"
@editorEvent="handleEditorEvent"
{{/if}}
{{#eq ctrlType 'grid'}}
:value="record.{{item.psEditor.name}}"
@editorEvent="($event) => handleEditorEvent(index,$event)"
{{/eq}}
/>
<IbizCheckboxList <IbizCheckboxList
name="{{item.codeName}}" name="{{item.codeName}}"
:value="state.data.{{item.psEditor.name}}"
:data="state.data" :data="state.data"
{{#if item.psEditor.disabled}} {{#if item.psEditor.disabled}}
:disabled="{{item.psEditor.disabled}}" :disabled="{{item.psEditor.disabled}}"
...@@ -21,4 +20,12 @@ ...@@ -21,4 +20,12 @@
{{/if}} {{/if}}
:contextProp="state.context" :contextProp="state.context"
:viewParamsProp="state.viewParams" :viewParamsProp="state.viewParams"
@editorEvent="handleEditorEvent"/> {{#if (or (eq ctrlType 'form') (eq ctrlType 'panel'))}}
:value="state.data.{{item.psEditor.name}}"
@editorEvent="handleEditorEvent"
{{/if}}
{{#eq ctrlType 'grid'}}
:value="record.{{item.psEditor.name}}"
@editorEvent="($event) => handleEditorEvent(index,$event)"
{{/eq}}
/>
<IbizCheckbox <IbizCheckbox
name="{{item.codeName}}" name="{{item.codeName}}"
:value="state.data.{{item.psEditor.name}}"
{{#if item.psEditor.disabled}} {{#if item.psEditor.disabled}}
:disabled="{{item.psEditor.disabled}}" :disabled="{{item.psEditor.disabled}}"
{{/if}} {{/if}}
{{#if item.psEditor.isReadOnly}} {{#if item.psEditor.isReadOnly}}
:readonly="{{item.psEditor.isReadOnly}}" :readonly="{{item.psEditor.isReadOnly}}"
{{/if}} {{/if}}
@editorEvent="handleEditorEvent"/> {{#if (or (eq ctrlType 'form') (eq ctrlType 'panel'))}}
:value="state.data.{{item.psEditor.name}}"
@editorEvent="handleEditorEvent"
{{/if}}
{{#eq ctrlType 'grid'}}
:value="record.{{item.psEditor.name}}"
@editorEvent="($event) => handleEditorEvent(index,$event)"
{{/eq}}
/>
<IbizDataPickerView <IbizDataPickerView
name="{{item.codeName}}" name="{{item.codeName}}"
:value="state.data.{{item.psEditor.name}}"
:data="state.data" :data="state.data"
{{#if item.valueItemName}} {{#if item.valueItemName}}
valueItem="{{item.valueItemName}}" valueItem="{{item.valueItemName}}"
...@@ -25,4 +24,12 @@ ...@@ -25,4 +24,12 @@
{{#if item.psEditor.pickUpData}} {{#if item.psEditor.pickUpData}}
pickUpData="{{item.psEditor.pickUpData}}" pickUpData="{{item.psEditor.pickUpData}}"
{{/if}} {{/if}}
@editorEvent="handleEditorEvent"/> {{#if (or (eq ctrlType 'form') (eq ctrlType 'panel'))}}
\ No newline at end of file :value="state.data.{{item.psEditor.name}}"
@editorEvent="handleEditorEvent"
{{/if}}
{{#eq ctrlType 'grid'}}
:value="record.{{item.psEditor.name}}"
@editorEvent="($event) => handleEditorEvent(index,$event)"
{{/eq}}
/>
\ No newline at end of file
<IbizDataPicker <IbizDataPicker
name="{{item.codeName}}" name="{{item.codeName}}"
:value="state.data.{{item.psEditor.name}}"
:data="state.data" :data="state.data"
{{#if item.valueItemName}} {{#if item.valueItemName}}
valueItem="{{item.valueItemName}}" valueItem="{{item.valueItemName}}"
...@@ -48,4 +47,12 @@ ...@@ -48,4 +47,12 @@
{{#if (or (eq item.psEditor.editorType "ADDRESSPICKUP") (eq item.psEditor.editorType "ADDRESSPICKUP_AC"))}} {{#if (or (eq item.psEditor.editorType "ADDRESSPICKUP") (eq item.psEditor.editorType "ADDRESSPICKUP_AC"))}}
:multiple="true" :multiple="true"
{{/if}} {{/if}}
@editorEvent="handleEditorEvent"/> {{#if (or (eq ctrlType 'form') (eq ctrlType 'panel'))}}
\ No newline at end of file :value="state.data.{{item.psEditor.name}}"
@editorEvent="handleEditorEvent"
{{/if}}
{{#eq ctrlType 'grid'}}
:value="record.{{item.psEditor.name}}"
@editorEvent="($event) => handleEditorEvent(index,$event)"
{{/eq}}
/>
\ No newline at end of file
<IbizDatePicker <IbizDatePicker
name="{{item.codeName}}" name="{{item.codeName}}"
:value="state.data.{{item.psEditor.name}}"
{{#if item.psEditor.placeHolder}} {{#if item.psEditor.placeHolder}}
placeholder="{{item.psEditor.placeHolder}}" placeholder="{{item.psEditor.placeHolder}}"
{{/if}} {{/if}}
...@@ -46,4 +45,12 @@ ...@@ -46,4 +45,12 @@
dateFormat="YYYY-MM-DD HH:mm" dateFormat="YYYY-MM-DD HH:mm"
dateType="dateTime" dateType="dateTime"
{{/eq}} {{/eq}}
@editorEvent="handleEditorEvent"/> {{#if (or (eq ctrlType 'form') (eq ctrlType 'panel'))}}
:value="state.data.{{item.psEditor.name}}"
@editorEvent="handleEditorEvent"
{{/if}}
{{#eq ctrlType 'grid'}}
:value="record.{{item.psEditor.name}}"
@editorEvent="($event) => handleEditorEvent(index,$event)"
{{/eq}}
/>
<IbizDropdownList <IbizDropdownList
name="{{item.codeName}}" name="{{item.codeName}}"
:value="state.data.{{item.psEditor.name}}"
:data="state.data" :data="state.data"
{{#if item.psEditor.codeList}} {{#if item.psEditor.codeList}}
codeListTag="{{item.psEditor.codeList.codeListTag}}" codeListTag="{{item.psEditor.codeList.codeListTag}}"
...@@ -27,4 +26,12 @@ ...@@ -27,4 +26,12 @@
{{/eq}} {{/eq}}
:contextProp="state.context" :contextProp="state.context"
:viewParamsProp="state.viewParams" :viewParamsProp="state.viewParams"
@editorEvent="handleEditorEvent"/> {{#if (or (eq ctrlType 'form') (eq ctrlType 'panel'))}}
:value="state.data.{{item.psEditor.name}}"
@editorEvent="handleEditorEvent"
{{/if}}
{{#eq ctrlType 'grid'}}
:value="record.{{item.psEditor.name}}"
@editorEvent="($event) => handleEditorEvent(index,$event)"
{{/eq}}
/>
<IbizInputIp <IbizInputIp
name="{{item.codeName}}" name="{{item.codeName}}"
:value="state.data.{{item.psEditor.name}}"
{{#if item.psEditor.disabled}} {{#if item.psEditor.disabled}}
:disabled="{{item.psEditor.disabled}}" :disabled="{{item.psEditor.disabled}}"
{{/if}} {{/if}}
{{#if item.psEditor.readOnly}} {{#if item.psEditor.readOnly}}
:readonly="{{item.psEditor.readOnly}}" :readonly="{{item.psEditor.readOnly}}"
{{/if}} {{/if}}
@editorEvent="handleEditorEvent"/> {{#if (or (eq ctrlType 'form') (eq ctrlType 'panel'))}}
:value="state.data.{{item.psEditor.name}}"
@editorEvent="handleEditorEvent"
{{/if}}
{{#eq ctrlType 'grid'}}
:value="record.{{item.psEditor.name}}"
@editorEvent="($event) => handleEditorEvent(index,$event)"
{{/eq}}
/>
<IbizInput <IbizInput
name="{{item.codeName}}" name="{{item.codeName}}"
:value="state.data.{{item.psEditor.name}}"
{{#if item.psEditor.placeHolder}} {{#if item.psEditor.placeHolder}}
placeholder="{{item.psEditor.placeHolder}}" placeholder="{{item.psEditor.placeHolder}}"
{{/if}} {{/if}}
...@@ -37,5 +36,13 @@ ...@@ -37,5 +36,13 @@
{{#eq item.psEditor.editorType "TEXTAREA"}} {{#eq item.psEditor.editorType "TEXTAREA"}}
type="textarea" type="textarea"
{{/eq}} {{/eq}}
@editorEvent="handleEditorEvent"/> {{#if (or (eq ctrlType 'form') (eq ctrlType 'panel'))}}
:value="state.data.{{item.psEditor.name}}"
@editorEvent="handleEditorEvent"
{{/if}}
{{#eq ctrlType 'grid'}}
:value="record.{{item.psEditor.name}}"
@editorEvent="($event) => handleEditorEvent(index,$event)"
{{/eq}}
/>
<IbizRadioGroup <IbizRadioGroup
name="{{item.codeName}}" name="{{item.codeName}}"
:value="state.data.{{item.psEditor.name}}"
:data="state.data" :data="state.data"
{{#if item.psEditor.codeList}} {{#if item.psEditor.codeList}}
codeListTag="{{item.psEditor.codeList.codeListTag}}" codeListTag="{{item.psEditor.codeList.codeListTag}}"
...@@ -21,4 +20,12 @@ ...@@ -21,4 +20,12 @@
{{/if}} {{/if}}
:contextProp="state.context" :contextProp="state.context"
:viewParamsProp="state.viewParams" :viewParamsProp="state.viewParams"
@editorEvent="handleEditorEvent"/> {{#if (or (eq ctrlType 'form') (eq ctrlType 'panel'))}}
\ No newline at end of file :value="state.data.{{item.psEditor.name}}"
@editorEvent="handleEditorEvent"
{{/if}}
{{#eq ctrlType 'grid'}}
:value="record.{{item.psEditor.name}}"
@editorEvent="($event) => handleEditorEvent(index,$event)"
{{/eq}}
/>
\ No newline at end of file
<IbizRating <IbizRating
name="{{item.codeName}}" name="{{item.codeName}}"
:value="state.data.{{item.psEditor.name}}"
{{#if item.psEditor.disabled}} {{#if item.psEditor.disabled}}
:disabled="{{item.psEditor.disabled}}" :disabled="{{item.psEditor.disabled}}"
{{/if}} {{/if}}
...@@ -13,4 +12,12 @@ ...@@ -13,4 +12,12 @@
{{#if item.psEditor.editorParams.allowHalf}} {{#if item.psEditor.editorParams.allowHalf}}
:allowHalf="{{item.psEditor.editorParams.allowHalf}}" :allowHalf="{{item.psEditor.editorParams.allowHalf}}"
{{/if}} {{/if}}
@editorEvent="handleEditorEvent"/> {{#if (or (eq ctrlType 'form') (eq ctrlType 'panel'))}}
:value="state.data.{{item.psEditor.name}}"
@editorEvent="handleEditorEvent"
{{/if}}
{{#eq ctrlType 'grid'}}
:value="record.{{item.psEditor.name}}"
@editorEvent="($event) => handleEditorEvent(index,$event)"
{{/eq}}
/>
<IbizRaw <IbizRaw
name="{{item.codeName}}" name="{{item.codeName}}"
:value="state.data.{{item.psEditor.name}}"
:date="state.data" :date="state.data"
{{#if item.psEditor.editorParams.contentType}} {{#if item.psEditor.editorParams.contentType}}
:contentType="{{item.psEditor.editorParams.contentType}}" :contentType="{{item.psEditor.editorParams.contentType}}"
...@@ -13,4 +12,12 @@ ...@@ -13,4 +12,12 @@
{{/if}} {{/if}}
:contextProp="state.context" :contextProp="state.context"
:viewParamsProp="state.viewParams" :viewParamsProp="state.viewParams"
@editorEvent="handleEditorEvent"/> {{#if (or (eq ctrlType 'form') (eq ctrlType 'panel'))}}
:value="state.data.{{item.psEditor.name}}"
@editorEvent="handleEditorEvent"
{{/if}}
{{#eq ctrlType 'grid'}}
:value="record.{{item.psEditor.name}}"
@editorEvent="($event) => handleEditorEvent(index,$event)"
{{/eq}}
/>
<IbizSlider <IbizSlider
name="{{item.codeName}}" name="{{item.codeName}}"
:value="state.data.{{item.psEditor.name}}"
:date="state.data" :date="state.data"
{{#if item.psEditor.disabled}} {{#if item.psEditor.disabled}}
:disabled="{{item.psEditor.disabled}}" :disabled="{{item.psEditor.disabled}}"
...@@ -17,4 +16,12 @@ ...@@ -17,4 +16,12 @@
{{#if item.psEditor.editorParams.max}} {{#if item.psEditor.editorParams.max}}
:max="{{item.psEditor.editorParams.max}}" :max="{{item.psEditor.editorParams.max}}"
{{/if}} {{/if}}
@editorEvent="handleEditorEvent"/> {{#if (or (eq ctrlType 'form') (eq ctrlType 'panel'))}}
:value="state.data.{{item.psEditor.name}}"
@editorEvent="handleEditorEvent"
{{/if}}
{{#eq ctrlType 'grid'}}
:value="record.{{item.psEditor.name}}"
@editorEvent="($event) => handleEditorEvent(index,$event)"
{{/eq}}
/>
<IbizSpan <IbizSpan
name="{{item.codeName}}" name="{{item.codeName}}"
:value="state.data.{{item.psEditor.name}}"
{{#if item.psEditor.codeList}} {{#if item.psEditor.codeList}}
codeListTag="{{item.psEditor.codeList.codeListTag}}" codeListTag="{{item.psEditor.codeList.codeListTag}}"
codeListType="{{item.psEditor.codeList.codeListType}}" codeListType="{{item.psEditor.codeList.codeListType}}"
...@@ -23,5 +22,11 @@ ...@@ -23,5 +22,11 @@
{{#if item.psEditor.psNavigateParams}} {{#if item.psEditor.psNavigateParams}}
localParam="{{item.psEditor.psNavigateParams}}" localParam="{{item.psEditor.psNavigateParams}}"
{{/if}} {{/if}}
{{#if (or (eq ctrlType 'form') (eq ctrlType 'panel'))}}
:value="state.data.{{item.psEditor.name}}"
{{/if}}
{{#eq ctrlType 'grid'}}
:value="record.{{item.psEditor.name}}"
{{/eq}}
:contextProp="state.context" :contextProp="state.context"
:viewParamsProp="state.viewParams"/> :viewParamsProp="state.viewParams"/>
<IbizStepper <IbizStepper
name="{{item.codeName}}" name="{{item.codeName}}"
:value="state.data.{{item.psEditor.name}}"
{{#if item.psEditor.disabled}} {{#if item.psEditor.disabled}}
:disabled="{{item.psEditor.disabled}}" :disabled="{{item.psEditor.disabled}}"
{{/if}} {{/if}}
...@@ -19,4 +18,12 @@ ...@@ -19,4 +18,12 @@
{{#if item.psEditor.editorParams.max}} {{#if item.psEditor.editorParams.max}}
:max="{{item.psEditor.editorParams.max}}" :max="{{item.psEditor.editorParams.max}}"
{{/if}} {{/if}}
@editorEvent="handleEditorEvent"/> {{#if (or (eq ctrlType 'form') (eq ctrlType 'panel'))}}
:value="state.data.{{item.psEditor.name}}"
@editorEvent="handleEditorEvent"
{{/if}}
{{#eq ctrlType 'grid'}}
:value="record.{{item.psEditor.name}}"
@editorEvent="($event) => handleEditorEvent(index,$event)"
{{/eq}}
/>
<IbizSwitch <IbizSwitch
name="{{item.codeName}}" name="{{item.codeName}}"
:value="state.data.{{item.psEditor.name}}"
{{#if item.psEditor.disabled}} {{#if item.psEditor.disabled}}
:disabled="{{item.psEditor.disabled}}" :disabled="{{item.psEditor.disabled}}"
{{/if}} {{/if}}
...@@ -10,4 +9,12 @@ ...@@ -10,4 +9,12 @@
{{#if item.psEditor.editorParams.size}} {{#if item.psEditor.editorParams.size}}
size="{{item.psEditor.editorParams.size}}" size="{{item.psEditor.editorParams.size}}"
{{/if}} {{/if}}
@editorEvent="handleEditorEvent"/> {{#if (or (eq ctrlType 'form') (eq ctrlType 'panel'))}}
:value="state.data.{{item.psEditor.name}}"
@editorEvent="handleEditorEvent"
{{/if}}
{{#eq ctrlType 'grid'}}
:value="record.{{item.psEditor.name}}"
@editorEvent="($event) => handleEditorEvent(index,$event)"
{{/eq}}
/>
<IbizUpload <IbizUpload
name="{{item.codeName}}" name="{{item.codeName}}"
:value="state.data.{{item.psEditor.name}}"
{{#if item.psEditor.editorParams.method}} {{#if item.psEditor.editorParams.method}}
method="{{item.psEditor.editorParams.method}}" method="{{item.psEditor.editorParams.method}}"
{{/if}} {{/if}}
...@@ -30,4 +29,12 @@ ...@@ -30,4 +29,12 @@
accept='image/*' accept='image/*'
listType="picture-card" listType="picture-card"
{{/eq}} {{/eq}}
@editorEvent="handleEditorEvent"/> {{#if (or (eq ctrlType 'form') (eq ctrlType 'panel'))}}
:value="state.data.{{item.psEditor.name}}"
@editorEvent="handleEditorEvent"
{{/if}}
{{#eq ctrlType 'grid'}}
:value="record.{{item.psEditor.name}}"
@editorEvent="($event) => handleEditorEvent(index,$event)"
{{/eq}}
/>
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<div style="flex-grow: {{#if item.psLayoutPos.grow}}{{item.psLayoutPos.grow}}{{else}}0{{/if}};"> <div style="flex-grow: {{#if item.psLayoutPos.grow}}{{item.psLayoutPos.grow}}{{else}}0{{/if}};">
<IbizFormItem name="{{item.codeName}}" label="{{item.caption}}"> <IbizFormItem name="{{item.codeName}}" label="{{item.caption}}">
{{#if item.psEditor}} {{#if item.psEditor}}
{{>(lookup . 'item.psEditor.editorType') item=item}} {{>(lookup . 'item.psEditor.editorType') item=item ctrlType="form"}}
{{/if}} {{/if}}
</IbizFormItem> </IbizFormItem>
</div> </div>
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<a-col :span="24"> <a-col :span="24">
<IbizFormItem name="{{item.codeName}}" label="{{item.caption}}"> <IbizFormItem name="{{item.codeName}}" label="{{item.caption}}">
{{#if item.psEditor}} {{#if item.psEditor}}
{{>(lookup . 'item.psEditor.editorType') item=item controlType="form"}} {{>(lookup . 'item.psEditor.editorType') item=item ctrlType="form"}}
{{/if}} {{/if}}
</IbizFormItem> </IbizFormItem>
</a-col> </a-col>
......
controlsAction:{ controlsAction:{
{{#each page.ctrls as | ctrl | }} loadAction: '{{ctrl.getPSControlAction.psAppDEMethod.codeName}}',
{{ctrl.codeName}}:{ removeAction: '{{ctrl.removePSControlAction.psAppDEMethod.codeName}}',
loadAction: '{{ctrl.getPSControlAction.psAppDEMethod.codeName}}', updateAction: '{{ctrl.updatePSControlAction.psAppDEMethod.codeName}}',
removeAction: '{{ctrl.removePSControlAction.psAppDEMethod.codeName}}', loadDraftAction: '{{ctrl.getDraftPSControlAction.psAppDEMethod.codeName}}',
updateAction: '{{ctrl.updatePSControlAction.psAppDEMethod.codeName}}', createAction: '{{ctrl.getDraftPSControlAction.psAppDEMethod.codeName}}',
loadDraftAction: '{{ctrl.getDraftPSControlAction.psAppDEMethod.codeName}}',
createAction: '{{ctrl.getDraftPSControlAction.psAppDEMethod.codeName}}',
},
{{/each}}
} }
\ No newline at end of file
...@@ -11,4 +11,14 @@ ...@@ -11,4 +11,14 @@
viewType: '{{page.viewType}}', viewType: '{{page.viewType}}',
viewStyle: '{{page.viewStyle}}', viewStyle: '{{page.viewStyle}}',
showCaptionBar: '{{page.viewStyle}}', showCaptionBar: '{{page.viewStyle}}',
viewToolbarModel: [
{{#page.ctrls}}
{{#eq controlType "TOOLBAR"}}
{{#psDEToolbarItems}}
{ name:'{{name}}',caption:'{{caption}}',groupExtractMode:'{{groupExtractMode}}',itemType:'{{itemType}}',noPrivDisplayMode:'{{noPrivDisplayMode}}',showIcon:{{showIcon}},showCaption:{{showCaption}},tooltip:'{{tooltip}}' },
{{/psDEToolbarItems}}
{{/eq}}
{{/page.ctrls}}
],
\ No newline at end of file
...@@ -22,11 +22,11 @@ ...@@ -22,11 +22,11 @@
{{/if}} {{/if}}
{{/if}} {{/if}}
{{#if (eq item.columnType 'UAGRIDCOLUMN')}} {{#if (eq item.columnType 'UAGRIDCOLUMN')}}
{{!-- <ibizToolbar <ibizToolbar
:toolbarModel="record.{{lowerCase item.codeName}}" mode="link"
:context="state.context" name="{{lowerCase item.codeName}}"
:viewParams="state.viewParams" :actionModel="record.{{lowerCase item.codeName}}"
@toolbarEvent="($event: ) => handleToolbarEvent()"/> --}} @toolbarEvent="($event) => handleToolbarEvent(record, $event)"/>
{{/if}} {{/if}}
</div> </div>
{{/if}} {{/if}}
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
itemType: "{{item.itemType}}", itemType: "{{item.itemType}}",
expanded: {{item.expanded}}, expanded: {{item.expanded}},
tooltip: "{{item.tooltip}}", tooltip: "{{item.tooltip}}",
funcTag: {{#if item.psAppFunc}}"{{item.psAppFunc.id}}"{{else}}''{{/if}}, funcTag: "{{item.psAppFunc.id}}",
hidden: {{#if item.hidden}}true{{else}}false{{/if}}, hidden: {{#if item.hidden}}true{{else}}false{{/if}},
disableClose: {{#if item.disableClose}}true{{else}}false{{/if}}, disableClose: {{#if item.disableClose}}true{{else}}false{{/if}},
{{#if item.counterId}} {{#if item.counterId}}
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
iconCls: "{{item.psSysImage.cssClass}}", iconCls: "{{item.psSysImage.cssClass}}",
{{/if}} {{/if}}
{{#if item.psSysImage.imagePath}} {{#if item.psSysImage.imagePath}}
icon: "{{item.psSysImage.imagePath}}", imgPath: "{{item.psSysImage.imagePath}}",
{{/if}} {{/if}}
{{/if}} {{/if}}
{{#if item.psNavigateContexts}} {{#if item.psNavigateContexts}}
......
{
{{#each app.pages as |appView|}}
"{{appView.codeName}}":{
"name": "{{appView.name}}",
"codeName": "{{appView.codeName}}",
"openMode": "{{#if appView.openMode}}{{appView.openMode}}{{else}}INDEXVIEWTAB{{/if}}",
"redirectView": {{appView.redirectView}},
"deResPaths": [
{{#each appView.appEntity.appEntityResources as |appEntityResource| }}
{{appEntityResource.deResPaths}}{{#unless @last}},{{/unless}}
{{/each}}
],
"parameters": [
{ "pathName": "views", "parameterName": "{{lowerCase appView.codeName}}" }
],
{{#if appView.capPSLanguageRes}}
"captionTag": "{{appView.capPSLanguageRes.lanResTag}}",
{{/if}}
"caption": "{{appView.caption}}",
{{#if appView.psSysImage}}
"imgPath": "{{appView.psSysImage.imagePath}}",
"iconCls": "{{appView.psSysImage.cssClass}}",
{{/if}}
"viewType": "{{appView.viewType}}",
"fileDir": "@page/{{#if psAppDataEntity}}{{spinalCase psAppDataEntity.codeName}}{{else}}default{{/if}}/{{spinalCase appView.codeName}}"
}{{#unless (and @last ../@last)}},{{/unless}}
{{/each}}
}
<script setup lang="ts"> <script setup lang="ts">
// This starter template is using Vue 3 <script setup> SFCs // This starter template is using Vue 3 <script setup> SFCs
// Check out https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup // Check out https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup
import {App} from '@service'
onMounted(async ()=>{
await App.init();
// App.openViewService.openView({codeName: 'ExampleEditorEditView'},{context: {},viewParams:{}})
})
</script> </script>
<template> <template>
......
...@@ -31,21 +31,33 @@ const showHeader = computed(()=> props.showHeader && (props.viewCaption || slot ...@@ -31,21 +31,33 @@ const showHeader = computed(()=> props.showHeader && (props.viewCaption || slot
</div> </div>
<slot name="header-bottom" /> <slot name="header-bottom" />
</div> </div>
<slot /> <div class="ibiz-view-layout__body">
<slot name="footer" /> <slot />
</div>
<div class="ibiz-view-footer">
<slot name="footer" />
</div>
</div> </div>
</template> </template>
<style lang="scss" scoped> <style lang="scss">
.ibiz-view-layout { .ibiz-view-layout {
height: 100%;
width: 100%;
}
.ibiz-view-layout__header-content{
display: flex; display: flex;
justify-content: space-between; flex-direction: column;
.ibiz-view-layout__caption{ padding: 0 24px 24px;
font-weight: 600; .ibiz-view-layout__header {
flex: none;
.ibiz-view-layout__header-content {
display: flex;
justify-content: space-between;
padding: 16px 0;
}
}
.ibiz-view-layout__body {
flex: auto;
}
.ibiz-view-layout__footer {
flex: none;
} }
} }
......
<script setup lang="ts">
import { IParam } from "@ibiz-core";
interface Props{
width: number;
height: number;
}
const props = withDefaults(defineProps<Props>(), {})
let style = reactive({width:'600px',height:'600px'});
/**
* Vue生命周期beforeMount
*/
onBeforeMount(() => {
if (props.width) {
style.width = props.width + 'px';
} else if(props.height){
style.height = props.height + 'px';
}
});
onMounted(()=>{
})
</script>
<template>
<div :style="style" class="ar-loading">
<div class="ar-loading-spinner">
<svg class="circular" viewBox="25 25 50 50">
<circle id="circle1" cx="50" cy="50" r="20" fill="none"></circle>
</svg>
</div>
</div>
</template>
<style lang="scss">
.ar-loading{
display: flex;
justify-content: center;
align-items: center;
&-spinner{
position: relative;
display: inline-block;
width: 80px;
height: 80px;
vertical-align: middle;
animation: ar-rotate 0.8s linear infinite;
.circular{
width: 100%;
height: 100%;
circle {
stroke: skyblue;
stroke-width: 3;
stroke-linecap: round;
animation: ar-circular 1.5s ease-in-out infinite;
}
}
}
}
@keyframes ar-rotate {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
@keyframes ar-circular {
0% {
stroke-dasharray: 1, 200;
stroke-dashoffset: 0;
}
50% {
stroke-dasharray: 90, 150;
stroke-dashoffset: -40;
}
100% {
stroke-dasharray: 90, 150;
stroke-dashoffset: -120;
}
}
</style>
\ No newline at end of file
...@@ -3,20 +3,31 @@ import { IParam, IActionParam } from "@ibiz-core"; ...@@ -3,20 +3,31 @@ import { IParam, IActionParam } from "@ibiz-core";
import { onBeforeMount, ref, Ref } from "vue"; import { onBeforeMount, ref, Ref } from "vue";
interface ToolbarProps { interface ToolbarProps {
/**
* @description 名称
*/
name: string;
/** /**
* @description 工具栏模型 * @description 模式
*/ */
toolbarModel: IParam; mode: 'button' | 'link';
/**
* @description 行为模型
*/
actionModel: IParam[];
} }
interface toolbarEmit { interface toolbarEmit {
(name: "toolbarEvent", value: IActionParam): void; (name: "toolbarEvent", value: IActionParam): void;
} }
const props = withDefaults(defineProps<ToolbarProps>(), {}); const props = withDefaults(defineProps<ToolbarProps>(), {
mode: 'button',
});
const emit = defineEmits<toolbarEmit>(); const emit = defineEmits<toolbarEmit>();
const items: Ref<IParam[]> = ref(props.toolbarModel?.items || []); const items: Ref<IParam[]> = ref(props.actionModel || []);
console.log(items);
const getItemClass = (item: IParam) => { const getItemClass = (item: IParam) => {
//todo 样式表 return item?.class;
return item.class;
}; };
const getItemIcon = (item: IParam) => { const getItemIcon = (item: IParam) => {
if (item.getPSSysImage) { if (item.getPSSysImage) {
...@@ -25,19 +36,21 @@ const getItemIcon = (item: IParam) => { ...@@ -25,19 +36,21 @@ const getItemIcon = (item: IParam) => {
}; };
const itemClick = (item: IParam) => { const itemClick = (item: IParam) => {
emit("toolbarEvent", { emit("toolbarEvent", {
tag: item.name, tag: props.name,
action: "toolbarEvent", action: "toolbarEvent",
data: item, data: item,
}); });
}; };
</script> </script>
<template> <template>
<div class="app-toolbar"> <div class="toolbar">
<template v-for="(item, index) in items" :key="index"> <a-space v-if="Object.is(mode,'button')" class="toolbar-button">
<template v-for="(item, index) in items" :key="index">
<a-tooltip <a-tooltip
v-if="Object.is(item.itemType, 'DEUIACTION')" v-if="Object.is(item.itemType, 'DEUIACTION')"
:title="item.tooltip" :title="item.tooltip"
> >
<!-- todo 无权限显示模式 -->
<a-button <a-button
v-show="true" v-show="true"
:class="['toolbar-item', getItemClass(item)]" :class="['toolbar-item', getItemClass(item)]"
...@@ -45,7 +58,7 @@ const itemClick = (item: IParam) => { ...@@ -45,7 +58,7 @@ const itemClick = (item: IParam) => {
type="primary" type="primary"
@click="itemClick(item)" @click="itemClick(item)"
> >
<a-icon v-show="item.showIcon" :type="getItemIcon(item)" /> <!-- <a-icon v-show="item.showIcon" :type="getItemIcon(item)" /> -->
\{{ item.showCaption ? item.caption : "" }} \{{ item.showCaption ? item.caption : "" }}
</a-button> </a-button>
</a-tooltip> </a-tooltip>
...@@ -63,24 +76,52 @@ const itemClick = (item: IParam) => { ...@@ -63,24 +76,52 @@ const itemClick = (item: IParam) => {
type="primary" type="primary"
@click="itemClick(childItem)" @click="itemClick(childItem)"
> >
<a-icon <!-- <a-icon
v-show="childItem.showIcon" v-show="childItem.showIcon"
:type="getItemIcon(childItem)" :type="getItemIcon(childItem)"
/> /> -->
\{{ childItem.showCaption ? childItem.caption : "" }} \{{ childItem.showCaption ? childItem.caption : "" }}
</a-menu-item> </a-menu-item>
</a-tooltip> </a-tooltip>
</a-menu> </a-menu>
</a-dropdown> </a-dropdown>
</template> </template>
</a-space>
<a-space v-else class="toolbar-link">
<template v-for="(item, index) in items" :key="index">
<a-button
v-show="item.visabled"
:class="['toolbar-item', getItemClass(item)]"
:disabled="item.disabled"
type="link"
@click="itemClick(item)"
>
<!-- <a-icon v-show="item.showIcon" :type="getItemIcon(item)" /> -->
\{{ item.showCaption ? item.caption : "" }}
</a-button>
<div v-if="item.separator" class="separator"></div>
</template>
</a-space>
</div> </div>
</template> </template>
<style scoped> <style lang='scss'>
.app-toolbar { .toolbar {
} .toolbar-link {
.app-toolbar .toolbar-item { gap: 0 !important;
margin-right: 8px; display: flex;
margin-bottom: 12px; flex-wrap: wrap;
.ant-space-item {
position: relative;
.separator {
position: absolute;
right: 0;
top: 15%;
height: 70%;
width: 1px;
background: #1890ff;
}
}
}
} }
</style> </style>
export const FuncConfig = [
{{#each app.allPSAppFuncs as | func |}}
{
name: "{{func.name}}",
funcTag: "{{func.codeName}}",
appFuncType: "{{func.appFuncType}}",
{{#if (eq func.appFuncType 'OPENHTMLPAGE')}}
htmlPageUrl: "{{func.htmlPageUrl}}",
{{/if}}
{{#if (eq func.appFuncType 'APPVIEW')}}
openMode: "{{func.openMode}}",
viewCodeName: "{{func.psAppView.codeName}}",
{{/if}}
navParam: {
{{#if func.psNavigateParams}}
{{#each func.psNavigateParams as | param |}}
{{lowerCase param.key}}: "{{#if param.rawValue}}{{param.value}}{{else}}%{{lowerCase param.value}}%{{/if}}",
{{/each}}
{{/if}}
},
navContext: {
{{#if func.psNavigateContexts}}
{{#each func.psNavigateContexts as | context |}}
{{lowerCase context.key}}: "{{#if context.rawValue}}{{context.value}}{{else}}%{{lowerCase context.value}}%{{/if}}",
{{/each}}
{{/if}}
},
},
{{/each}}
]
\ No newline at end of file
import { IParam, FuncConfig } from "@ibiz-core";
import { App } from "@service";
export class AppFuncService {
/**
* @description 唯一实例
* @private
* @static
* @memberof AppFuncService
*/
private static readonly instance = new AppFuncService();
/**
* @description 获取唯一实例
* @static
* @return {*} {AppFuncService}
* @memberof AppFuncService
*/
public static getInstance(): AppFuncService {
return AppFuncService.instance;
}
/**
* @description 执行应用功能
* @param {string} menu 菜单项
* @param {IParam} context 上下文
* @param {IParam} viewParams 视图参数
* @memberof AppFuncService
*/
executeAppFunc(menu: IParam, context: IParam, viewParams: IParam) {
const appFunc = FuncConfig.find((func: IParam)=> Object.is(func.funcTag, menu.funcTag));
if (appFunc) {
switch (appFunc.appFuncType) {
case 'APPVIEW':
return this.openAppView(appFunc, context, viewParams);
case 'OPENHTMLPAGE':
return this.openHtmlPage(appFunc, context, viewParams);
case 'PDTAPPFUNC':
return this.executePresetFunc(appFunc, context, viewParams);
case 'JAVASCRIPT':
return this.executeJavaScript(appFunc, context, viewParams);
case 'CUSTOM':
return this.executeCustomFunc(appFunc, context, viewParams);
default:
console.warn(`${appFunc.appFuncType} 类型应用功能暂未支持`);
}
} else {
console.warn(`菜单项 ${menu.caption} 未配置应用功能`);
}
}
/**
* @description 执行自定义功能
* @param {IParam} appFunc 应用功能
* @param {IParam} context 上下文
* @param {IParam} viewParams 视图参数
* @memberof AppFuncService
*/
executeCustomFunc(appFunc: IParam, context: IParam, viewParams: IParam) {
console.warn(`${appFunc.appFuncType} 类型应用功能暂未支持`);
}
/**
* @description 执行JavaScript
* @param {IParam} appFunc 应用功能
* @param {IParam} context 上下文
* @param {IParam} viewParams 视图参数
* @memberof AppFuncService
*/
executeJavaScript(appFunc: IParam, context: IParam, viewParams: IParam) {
console.warn(`${appFunc.appFuncType} 类型应用功能暂未支持`);
}
/**
* @description 执行预置应用功能
* @static
* @param {IParam} appFunc 应用功能
* @param {IParam} context 上下文
* @param {IParam} viewParams 视图参数
* @memberof AppFuncService
*/
executePresetFunc(appFunc: IParam, context: IParam, viewParams: IParam) {
console.warn(`${appFunc.appFuncType} 类型应用功能暂未支持`);
}
/**
* @description 打开HTML页面
* @param {IParam} appFunc 应用功能
* @param {IParam} context 上下文
* @param {IParam} viewParams 视图参数
* @memberof AppFuncService
*/
openHtmlPage(appFunc: IParam, context: IParam, viewParams: IParam) {
window.open(appFunc.htmlPageUrl, '_blank');
}
/**
* @description 打开应用视图
* @param {IParam} appFunc 应用功能
* @param {IParam} context 上下文
* @param {IParam} viewParams 视图参数
* @memberof AppFuncService
*/
openAppView(appFunc: IParam, context: IParam, viewParams: IParam) {
const view = {
codeName: appFunc.viewCodeName,
openMode: appFunc.openMode,
}
const params = {
context: context,
viewParams: viewParams,
}
App.openViewService.openView(view, params);
}
}
\ No newline at end of file
export * from './app-func-service';
export * from './app-func-config';
\ No newline at end of file
...@@ -2,4 +2,5 @@ export * from './interface'; ...@@ -2,4 +2,5 @@ export * from './interface';
export * from './modules'; export * from './modules';
export * from './runtime'; export * from './runtime';
export * from './service'; export * from './service';
export * from './utils' export * from './utils';
\ No newline at end of file export * from './helper';
\ No newline at end of file
...@@ -43,6 +43,13 @@ export interface ViewStateBase { ...@@ -43,6 +43,13 @@ export interface ViewStateBase {
*/ */
viewSubject: Subject<IActionParam>; viewSubject: Subject<IActionParam>;
/**
* @description 视图工具栏模型
* @type {IParam[]}
* @memberof ViewStateBase
*/
viewToolbarModel: IParam[];
// 声明任意属性 // 声明任意属性
[propName: string]: any; [propName: string]: any;
} }
...@@ -23,11 +23,11 @@ export interface GridControlState extends MainControlState { ...@@ -23,11 +23,11 @@ export interface GridControlState extends MainControlState {
columnsModel: IParam[]; columnsModel: IParam[];
/** /**
* @description 表格界面行为模型 * @description 表格操作列行为模型
* @type {IParam} * @type {IParam}
* @memberof GridControlState * @memberof GridControlState
*/ */
actionModel: IParam; uAColumnModel: IParam[];
/** /**
* @description 值规则 * @description 值规则
......
...@@ -53,10 +53,10 @@ export class GridControl extends MainControl { ...@@ -53,10 +53,10 @@ export class GridControl extends MainControl {
* @memberof GridControl * @memberof GridControl
*/ */
public getActionAuthState(rowData: IParam) { public getActionAuthState(rowData: IParam) {
const { UIService, actionModel } = this.controlState; const { UIService, uAColumnModel } = this.controlState;
let tempActionModel: any = deepCopy(actionModel); let tempModel: any = deepCopy(uAColumnModel);
calcActionItemAuthState(rowData, tempActionModel, UIService); calcActionItemAuthState(rowData, tempModel, UIService);
return tempActionModel; return tempModel;
} }
/** /**
...@@ -374,7 +374,7 @@ export class GridControl extends MainControl { ...@@ -374,7 +374,7 @@ export class GridControl extends MainControl {
// return // return
// } // }
const data = []; const data = [];
for (let i = 0; i < 100; i++) { for (let i = 0; i < 40; i++) {
data.push({ data.push({
group: i % 2 === 1 ? "分组1": "分组2", group: i % 2 === 1 ? "分组1": "分组2",
srfkey: i, srfkey: i,
...@@ -389,7 +389,7 @@ export class GridControl extends MainControl { ...@@ -389,7 +389,7 @@ export class GridControl extends MainControl {
// dataRef.value = response.data; // dataRef.value = response.data;
if (enablePagingBar) { if (enablePagingBar) {
// paginationRef.value['total'] = response.total; // paginationRef.value['total'] = response.total;
paginationRef.value["total"] = 100; paginationRef.value["total"] = 40;
} }
this.calcGridAuthState(); this.calcGridAuthState();
this.handleDefaultSelect(); this.handleDefaultSelect();
...@@ -435,6 +435,17 @@ export class GridControl extends MainControl { ...@@ -435,6 +435,17 @@ export class GridControl extends MainControl {
} }
} }
/**
* @description 处理工具栏事件
* @param {IActionParam} actionParam 行为参数
* @param {IParam} [row] 表格行数据
* @memberof GridControl
*/
public handleToolbarEvent(actionParam: IActionParam, row?: IParam) {
const { tag, action, data } = actionParam;
console.log('触发界面行为', actionParam, row);
}
/** /**
* @description 安装部件所有功能模块的方法 * @description 安装部件所有功能模块的方法
* @param {GridControlProps} props 传入的Props * @param {GridControlProps} props 传入的Props
...@@ -451,6 +462,7 @@ export class GridControl extends MainControl { ...@@ -451,6 +462,7 @@ export class GridControl extends MainControl {
state: this.controlState, state: this.controlState,
load, load,
handleEditorEvent: this.handleEditorEvent.bind(this), handleEditorEvent: this.handleEditorEvent.bind(this),
handleToolbarEvent: this.handleToolbarEvent.bind(this),
}; };
} }
} }
import { Ref } from 'vue'; import { Ref } from 'vue';
import { MenuControlProps, MenuControlState, IActionParam, ControlBase, IParam } from '@ibiz-core'; import { MenuControlProps, MenuControlState, IActionParam, ControlBase, IParam, AppFuncService, deepCopy } from '@ibiz-core';
import { App } from '@service';
/** /**
* @description 菜单部件 * @description 菜单部件
...@@ -163,7 +164,8 @@ export class MenuControl extends ControlBase { ...@@ -163,7 +164,8 @@ export class MenuControl extends ControlBase {
* @memberof MenuControl * @memberof MenuControl
*/ */
public menuClick(item: IParam) { public menuClick(item: IParam) {
console.log(item); const { context, viewParams } = this.controlState;
App.appFuncService.executeAppFunc(item, deepCopy(context), deepCopy(viewParams));
} }
/** /**
......
export * from './util'; export * from './util';
export * from './view-util'; export * from './view-util';
export * from './route-tool';
export { Http } from './net/http'; export { Http } from './net/http';
\ No newline at end of file
...@@ -20,6 +20,16 @@ export function isExist(arg: any): boolean{ ...@@ -20,6 +20,16 @@ export function isExist(arg: any): boolean{
return arg !== undefined && arg !== null && arg === arg; return arg !== undefined && arg !== null && arg === arg;
} }
/**
* @description 除undefined,null,NaN,空字符串以外都为true
* @export
* @param {*} arg
* @return {*} {boolean}
*/
export function notEmpty(arg: any): boolean{
return isExist(arg) && arg != '';
}
/** /**
* @description 是否拥有某个方法 * @description 是否拥有某个方法
* @param {*} arg 校验对象 * @param {*} arg 校验对象
......
export const ViewConfig = { export const ViewConfig = {
{{> @macro/front-end/view/common/viewBaseConfig.hbs}} {{> @macro/front-end/view/common/viewBaseConfig.hbs}}
{{#page.ctrls}} {{#each page.ctrls as | ctrl |}}
{{#eq controlType "TOOLBAR"}} {{#if (eq ctrl.controlType "FORM")}}
{{lowerCase codeName}}:{ {{> @macro/front-end/view/common/controlAction.hbs ctrl=ctrl}}
name:'{{name}}', {{/if}}
items:[ {{/each}}
{{#psDEToolbarItems}}
{ name:'{{name}}',caption:'{{caption}}',groupExtractMode:'{{groupExtractMode}}',itemType:'{{itemType}}',noPrivDisplayMode:'{{noPrivDisplayMode}}',showIcon:{{showIcon}},showCaption:{{showCaption}},tooltip:'{{tooltip}}' },
{{/psDEToolbarItems}}
]
},
{{/eq}}
{{/page.ctrls}}
{{> @macro/front-end/view/common/controlAction.hbs}}
}; };
\ No newline at end of file
...@@ -44,26 +44,26 @@ const { state, handleToolbarEvent } = new EditView(ViewConfig).moduleInstall(pro ...@@ -44,26 +44,26 @@ const { state, handleToolbarEvent } = new EditView(ViewConfig).moduleInstall(pro
:text="state.viewCaption" :text="state.viewCaption"
/> />
</template> </template>
{{#page.ctrls}} {{#page.ctrls}}
{{#eq controlType "TOOLBAR"}} {{#eq controlType "TOOLBAR"}}
<template v-slot:header-right> <template v-slot:header-right>
<IbizToolbar <IbizToolbar
:toolbarModel="state.{{lowerCase codeName}}" mode="button"
@toolbarEvent="handleToolbarEvent" name="{{lowerCase codeName}}"
:context="state.context" :actionModel="state.viewToolbarModel"
:viewParams="state.viewParams"/> @toolbarEvent="handleToolbarEvent"/>
</template> </template>
{{/eq}} {{/eq}}
{{#eq controlType "FORM"}} {{#eq controlType "FORM"}}
<{{codeName}}Form <{{codeName}}Form
:showBusyIndicator="true" :showBusyIndicator="true"
:context="state.context" :context="state.context"
:viewParams="state.viewParams" :viewParams="state.viewParams"
:controlAction="state.controlsAction.{{codeName}}" :controlAction="state.controlsAction.{{codeName}}"
:viewSubject="state.viewSubject" :viewSubject="state.viewSubject"
></{{codeName}}Form> ></{{codeName}}Form>
{{/eq}} {{/eq}}
{{/page.ctrls}} {{/page.ctrls}}
</IbizDefaultViewLayout> </IbizDefaultViewLayout>
</template> </template>
......
export const ViewConfig = { export const ViewConfig = {
viewCodeName: '{{page.codeName}}',
viewName: '{{page.name}}',
viewCaption: '{{page.caption}}',
gridRowActiveMode: {{page.gridRowActiveMode}}, gridRowActiveMode: {{page.gridRowActiveMode}},
rowEditState: {{#if page.enableRowEdit}}{{page.rowEditDefault}}{{else}}false{{/if}}, rowEditState: {{#if page.enableRowEdit}}{{page.rowEditDefault}}{{else}}false{{/if}},
{{> @macro/front-end/view/common/controlAction.hbs}} {{> @macro/front-end/view/common/viewBaseConfig.hbs}}
{{#each page.ctrls as | ctrl |}}
{{#if (eq ctrl.controlType "GRID")}}
{{> @macro/front-end/view/common/controlAction.hbs ctrl=ctrl}}
{{/if}}
{{/each}}
}; };
\ No newline at end of file
...@@ -38,23 +38,29 @@ const { state, handleCtrlEvent } = new GridView(ViewConfig).moduleInstall(props) ...@@ -38,23 +38,29 @@ const { state, handleCtrlEvent } = new GridView(ViewConfig).moduleInstall(props)
<template v-slot:header-left> <template v-slot:header-left>
<IbizIconText class="ibiz-view__caption" size="large" :text="state.viewCaption" /> <IbizIconText class="ibiz-view__caption" size="large" :text="state.viewCaption" />
</template> </template>
{{#page.ctrls}}
{{#eq controlType "TOOLBAR"}}
<template v-slot:header-right> <template v-slot:header-right>
<span>工具栏部件</span> <IbizToolbar
mode="button"
name="{{lowerCase codeName}}"
:actionModel="state.viewToolbarModel"
@toolbarEvent="handleToolbarEvent"/>
</template> </template>
{{#page.ctrls}} {{/eq}}
{{#eq controlType "GRID"}} {{#eq controlType "GRID"}}
<{{codeName}}Grid <{{codeName}}Grid
:context="state.context" :context="state.context"
:rowEditState="state.rowEditState" :rowEditState="state.rowEditState"
:rowActiveMode="state.gridRowActiveMode" :rowActiveMode="state.gridRowActiveMode"
:showBusyIndicator="true" :showBusyIndicator="true"
:viewParams="state.viewParams" :viewParams="state.viewParams"
:controlAction="state.controlsAction" :controlAction="state.controlsAction"
:viewSubject="state.viewSubject" :viewSubject="state.viewSubject"
@ctrlEvent="handleCtrlEvent" @ctrlEvent="handleCtrlEvent"
></{{codeName}}Grid> ></{{codeName}}Grid>
{{/eq}} {{/eq}}
{{/page.ctrls}} {{/page.ctrls}}
</IbizDefaultViewLayout> </IbizDefaultViewLayout>
</template> </template>
......
import { AppModal } from '@/utils';
import { Http, deepCopy } from '@ibiz-core';
import { OpenViewService } from '@service';
import { AppFuncService } from '@ibiz-core';
export class App {
/**
* 打开视图服务
* @static
*/
public static openViewService: OpenViewService = OpenViewService.getInstance();
/**
* 应用功能服务
* @static
*/
public static appFuncService: AppFuncService = AppFuncService.getInstance();
/**
* 打开视图服务
* @static
*/
public static modalService: AppModal = AppModal.getInstance();
/**
* 所有视图信息
*
* @static
*/
public static allViewInfos: any;
/**
* 获取视图信息
*
* @static
* @param codeName 视图codeName
* @return {*}
*/
public static getViewInfo(codeName: string){
return App.allViewInfos[codeName] ? deepCopy(App.allViewInfos[codeName]) : undefined;
}
/**
* 初始化
*
* @static
*/
public static async init(){
const response = await Http.getInstance().get('./assets/json/views.json')
App.allViewInfos = response.data;
}
}
\ No newline at end of file
export * from './open-view/open-view-service';
export * from './app/app';
\ No newline at end of file
import { deepCopy, IParam, RouteTool } from '@ibiz-core';
import { App } from '@service';
import router from '@/router';
interface View extends IParam {
codeName: string;
openMode?: string;
}
interface Params extends IParam {
context: any;
viewParams: any;
}
/**
* 视图打开服务
* @export
* @class OpenViewService
*/
export class OpenViewService {
/**
* 唯一实例
*
* @private
* @static
* @memberof OpenViewService
*/
private static readonly instance = new OpenViewService();
/**
* 获取唯一实例
*
* @static
* @return {*} {OpenViewService}
* @memberof OpenViewService
*/
public static getInstance(): OpenViewService {
return OpenViewService.instance;
}
/**
* 打开视图
*
* @param view 视图信息
* @param params 相关参数
*/
public openView(view: View, params: Params) {
// 获取详细视图信息
let _view: any = App.getViewInfo(view.codeName);
if (!_view) {
console.error(`应用中不存在${view.codeName}视图`);
return;
}
// view的openMode覆盖配置的
if (view.openMode) {
_view.openMode = view.openMode;
}
// 重定向视图走重定向逻辑,其他根据openMode打开
if (_view.redirectView) {
this.openRedirectView(_view, params);
} else {
this.openByOpenMode(_view, params);
}
}
/**
* 根据打开方式打开视图
*
* @param view 视图信息
* @param params 相关参数
*/
public openByOpenMode(view: any, params: Params) {
const { openMode } = view;
const { viewParams, context } = params;
// 路由打开视图
if (openMode == 'INDEXVIEWTAB' || openMode == 'POPUPAPP') {
// TODO 视图关系参数处理
const routePath = RouteTool.buildUpRoutePath(view, context, viewParams, router.currentRoute.value);
if (openMode == 'INDEXVIEWTAB') {
router.push(routePath);
} else {
window.open('./#' + routePath, '_blank');
}
} else if (openMode == 'POPUPMODAL') {
} else if (openMode.indexOf('DRAWER') !== -1) {
// TODO PMS上面抽屉DRAWER_TOP
} else if (openMode == 'POPOVER') {
// TODO 打开气泡卡片
} else {
console.error(`未支持${openMode}打开方式`);
}
}
/**
* 重定向视图处理
*
* @param view 视图信息
* @param params 相关参数
*/
public openRedirectView(view: any, params: Params) {
// TODO 重定向视图处理
}
}
import { createVNode, render as vueRender } from 'vue'
import { Subject } from 'rxjs';
import Antd from 'ant-design-vue';
// import { AppServiceBase, LogUtil } from 'ibiz-core';
import AppModalComponent from "./app-modal.vue";
import IbizLoading from '@components/render/IbizLoading.vue';
export class AppModal {
/**
* 实例对象
*
* @private
* @static
* @memberof AppModal
*/
private static modal = new AppModal();
/**
* vue 实例
*
* @private
* @type {Vue}
* @memberof AppModal
*/
private vueExample!: any;
/**
* store对象
*
* @private
* @memberof AppModal
*/
private store: any;
/**
* i18n对象
*
* @private
* @memberof AppModal
*/
private i18n: any;
/**
* router对象
*
* @private
* @memberof AppModal
*/
private router: any;
/**
* Creates an instance of AppModal.
*
* @memberof AppModal
*/
private constructor() {
this.initBasicData();
if (AppModal.modal) {
return AppModal.modal;
}
}
/**
* 获取单例对象
*
* @static
* @returns {AppModal}
* @memberof AppModal
*/
public static getInstance(): AppModal {
if (!AppModal.modal) {
AppModal.modal = new AppModal();
}
return AppModal.modal;
}
/**
* 初始化基础数据
*
* @memberof AppModal
*/
private initBasicData() {
// const appService = AppServiceBase.getInstance();
// this.store = appService.getAppStore();
// this.i18n = appService.getI18n();
// this.router = appService.getRouter();
}
/**
* 创建 Vue 实例对象
*
* @private
* @param \{{ name: string, title: string, fileDir: string, width?: number, height?: number,isfullscreen?:boolean }} view 视图数据
* @param {*} [context={}] 应用上下文参数
* @param {*} [viewparams={}] 视图参数
* @param {*} [navdatas=[]] 导航数据
* @param {string} uuid 标识
* @returns {Subject<any>}
* @memberof AppModal
*/
private createVueExample(view: { name: string, title: string, fileDir:string, width?: number, height?: number, isfullscreen?: boolean, customClass?: string }, context: any = {}, viewparams: any = {}, navdatas: Array<any> = [], uuid: string): Subject<any> {
const self: any = this;
if (!self.store || !self.i18n) {
self.initBasicData();
}
try {
let subject: null | Subject<any> = new Subject<any>();
let props = { view: view, viewdata: context, viewparams: viewparams, navdatas: navdatas, uuid: uuid, subject: subject };
let dir = view.fileDir.replace(/@/, '../../')
const AsyncComp = defineAsyncComponent({
// 工厂函数
loader: () => import(dir),
// 加载异步组件时要使用的组件
loadingComponent: IbizLoading,
// 在显示 loadingComponent 之前的延迟 | 默认值:200(单位 ms)
delay: 0,
});
if (AsyncComp) {
const component = AppModalComponent;
const div = document.createElement('div');
document.body.appendChild(div);
const app = createApp(component,
{
close: () => { document.body.removeChild(div); app.unmount(); },
...props
}
);
app.component(view.name, AsyncComp);
const vm = app.use(Antd).mount(div);
this.vueExample = vm;
}
return subject;
} catch (error) {
console.error(error);
return new Subject<any>();
}
}
/**
* 打开模态视图
*
* @param \{{ name: string, title: string, fileDir:string, width?: number, height?: number }} view 视图
* @param {*} [viewParam={}] 应用上下文参数
* @param {any[]} deResParameters 关系实体参数对象
* @param {any[]} parameters 当前应用视图参数对象
* @param {any[]} args 多项数据
* @param {*} [data={}] 行为参数
* @param {any[]} navdatas 导航数据
* @returns {Subject<any>}
* @memberof AppModal
*/
public openModal(view: { name: string, title: string, fileDir:string, width?: number, height?: number, isfullscreen?: boolean, customClass?: string }, context: any = {}, data: any = {}, navdatas: Array<any> = []): Subject<any> {
try {
let viewdata: any = {};
Object.assign(viewdata, JSON.parse(JSON.stringify(context)));
const uuid = this.getUUID();
const subject = this.createVueExample(view, viewdata, data, navdatas, uuid);
return subject;
} catch (error) {
console.log(error);
return new Subject<any>();
}
}
/**
* 获取节点标识
*
* @private
* @returns {string}
* @memberof AppModal
*/
private getUUID(): string {
function s4() {
return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
}
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
}
}
\ No newline at end of file
<script setup lang="ts">
import { Subject } from 'rxjs';
import { Ref, ref } from 'vue';
interface AppModalProps {
/**
* @description 视图
*/
view: any;
/**
* @description 视图上下文参数
*/
viewdata?: any;
/**
* @description 视图参数
*/
viewparams?: any;
/**
* @description 导航数据
*/
navdatas?: any;
/**
* @description 数据传递对象
*/
subject?:any
/**
* @description 关闭回调
*/
close:Function;
}
const props = withDefaults(defineProps<AppModalProps>(), {
view:{},
viewdata: {},
viewparams: {},
navdatas: [],
});
/**
* 是否显示
*/
let isShow: Ref<boolean> = ref(false);
/**
* 是否满屏
*/
let isfullscreen: Ref<boolean> = ref(false);
/**
* 零时结果
*/
let tempResult = { ret: '' };
/**
* 视图名称
*/
let viewname: Ref<string> = ref('');
/**
* 视图标题
*/
let title: string = '';
/**
* 视图宽度
*/
let width: Ref<number> = ref(0);
/**
* 视图高度
*/
let height: Ref<number> = ref(0);
/**
* 视图层级
*/
let zIndex: any = null;
/**
* 视图样式
*/
let style: any = {};
/**
* 暴露subject
*/
const getSubject = () => {
return props.subject;
}
/**
* 监听isShow
*/
watch(
() => isShow,
(newVal, oldVal) => {
if (newVal !== oldVal && newVal.value == false) {
zIndex -= 100;
// this.$store.commit('updateZIndex', this.zIndex);
}
},
);
/**
* Vue生命周期beforeMount
*/
onBeforeMount(() => {
if (props.view) {
viewname.value = props.view.name;
title = props.view.title;
isfullscreen.value = props.view.isfullscreen ? props.view.isfullscreen : false;
if (isfullscreen.value) {
Object.assign(style, { height: 'auto' });
} else {
if (!props.view.width || props.view.width === 0 || Object.is(props.view.width, '0px')) {
let viewWidth = 600;
if (window && window.innerWidth > 100) {
if (window.innerWidth > 100) {
viewWidth = window.innerWidth - 100;
} else {
viewWidth = window.innerWidth;
}
}
width.value = viewWidth;
} else {
width.value = props.view.width;
}
if (props.view.height && !Object.is(props.view.height, '0px')) {
Object.assign(style, { height: props.view.height + 'px' });
height.value = props.view.height;
} else {
height.value = 800;
}
}
}
});
/**
* Vue生命周期mounted
*/
onMounted(() => {
// const curmodal: any = this.$refs.curmodal;
// const zIndex = this.$store.getters.getZIndex();
// if (zIndex) {
// this.zIndex = zIndex + 100;
// this.$store.commit('updateZIndex', this.zIndex);
// }
isShow.value = true;
});
/**
* 视图关闭
*/
const close = (result: any) => {
if (result && Array.isArray(result) && result.length > 0) {
if (zIndex) {
// this.$store.commit('updateZIndex', zIndex - 100);
}
Object.assign(tempResult, { ret: 'OK' }, { datas: JSON.parse(JSON.stringify(result)) });
}
isShow.value = false;
};
/**
* 视图数据变化
*/
const dataChange = (result: any) => {
tempResult = { ret: '' };
if (result && Array.isArray(result) && result.length > 0) {
Object.assign(tempResult, { ret: 'OK' }, { datas: JSON.parse(JSON.stringify(result)) });
}
};
/**
* 视图数据激活
*/
const viewDatasActivated = (result: any) => {
if (result && Array.isArray(result) && result.length > 0) {
close(result);
}
};
/**
* 模态显示隐藏切换回调
*/
const onVisibleChange = ($event: any) => {
handleShowState($event);
};
/**
* 处理数据,向外抛值
*/
const handleShowState = ($event: any) => {
if (props.subject && tempResult) {
props.subject.next(tempResult);
}
setTimeout(() => {
props.close();
}, 500);
};
</script>
<template>
<a-modal
ref="curModal"
class="app-modal"
v-model:visible="isShow"
:title="title"
:footer="null"
:maskClosable="true"
:destroyOnClose="true"
:width="width"
:bodyStyle="style"
@cancel="onVisibleChange($event)"
>
<component
:is="viewname"
class="viewcontainer2"
:width="width"
:height="height"
:viewdata="JSON.stringify(viewdata)"
:viewparam="JSON.stringify(viewparams)"
:navdatas="navdatas"
:viewDefaultUsage="false"
:noViewCaption="true"
@viewdataschange="dataChange($event)"
@viewdatasactivated="viewDatasActivated($event)"
@close="close($event)"
:ref="viewname"
></component>
</a-modal>
</template>
...@@ -9,7 +9,5 @@ export const CtrlConfig = { ...@@ -9,7 +9,5 @@ export const CtrlConfig = {
{{>(lookup 'MENUITEM') item=item}} {{>(lookup 'MENUITEM') item=item}}
{{/each}} {{/each}}
], ],
funcs: [ funcs: [],
],
}; };
\ No newline at end of file
...@@ -56,10 +56,10 @@ export class ControlVO extends ControlVOBase { ...@@ -56,10 +56,10 @@ export class ControlVO extends ControlVOBase {
{{/neq}} {{/neq}}
{{/each}} {{/each}}
// 表单里没有映射实体属性的字段 // 表单里没有映射实体属性的字段(srfuf除外)
{{#each ctrl.psDEFormItems as | formItem | }} {{#each ctrl.psDEFormItems as | formItem | }}
{{#eq formItem.psAppDEField null }} {{#if (and (eq formItem.psAppDEField null) (neq formItem.id "srfuf" )) }}
{{lowerCase formItem.id}}: any; {{lowerCase formItem.id}}: any;
{{/eq}} {{/if}}
{{/each}} {{/each}}
} }
\ No newline at end of file
...@@ -43,6 +43,17 @@ export const CtrlConfig = { ...@@ -43,6 +43,17 @@ export const CtrlConfig = {
enablePagingBar: false, enablePagingBar: false,
pagination: false, pagination: false,
{{/if}} {{/if}}
uAColumnModel:[
{{#each ctrl.psDEGridColumns as | column |}}
{{#if (eq column.columnType 'UAGRIDCOLUMN')}}
{{#each column.psDEUIActionGroup.psUIActionGroupDetails as | action |}}
{{#action}}
{ name: "{{name}}", caption: "{{psUIAction.caption}}", showIcon: {{showIcon}}, showCaption: {{showCaption}}, separator: {{addSeparator}}, uIActionTag: "{{psUIAction.uIActionTag}}", noPrivDisplayMode: {{#if psUIAction.noPrivDisplayMode}}{{psUIAction.noPrivDisplayMode}}{{else}}6{{/if}}, disabled: false, visabled: true,{{#if psUIAction.psSysImage}}{{#if psUIAction.psSysImage.imagePath}} imgPath: "{{psUIAction.psSysImage.imagePath}}",{{/if}}{{#if psUIAction.psSysImage.cssClass}} iconCls: "{{psUIAction.psSysImage.cssClass}}",{{/if}}{{/if}} },
{{/action}}
{{/each}}
{{/if}}
{{/each}}
],
columnsModel: [ columnsModel: [
{{#if ctrl.enableGroup}} {{#if ctrl.enableGroup}}
{{#if ctrl.groupPSAppDEField}} {{#if ctrl.groupPSAppDEField}}
...@@ -58,11 +69,7 @@ export const CtrlConfig = { ...@@ -58,11 +69,7 @@ export const CtrlConfig = {
{{/if}} {{/if}}
{{/if}} {{/if}}
{{#each ctrl.psDEGridColumns as | column |}} {{#each ctrl.psDEGridColumns as | column |}}
{{#if @last}} {{>(lookup 'COLUMNMODEL') item=column}}
{{>(lookup 'COLUMNMODEL') item=column lastColumn=true}}
{{else}}
{{>(lookup 'COLUMNMODEL') item=column lastColumn=false}}
{{/if}}
{{/each}} {{/each}}
] ],
}; };
\ No newline at end of file
...@@ -32,7 +32,7 @@ interface CtrlEmit { ...@@ -32,7 +32,7 @@ interface CtrlEmit {
} }
const emit = defineEmits<CtrlEmit>(); const emit = defineEmits<CtrlEmit>();
// 安装功能模块,提供状态和能力方法 // 安装功能模块,提供状态和能力方法
const { state, load, handleEditorEvent } = new GridControl(CtrlConfig).moduleInstall(props); const { state, load, handleEditorEvent, handleToolbarEvent } = new GridControl(CtrlConfig).moduleInstall(props);
// 表格滚动条配置 // 表格滚动条配置
const gridScrollOption = computed(() => { const gridScrollOption = computed(() => {
return { return {
...@@ -72,7 +72,7 @@ const customRow = (record: IParam, index: number) => { ...@@ -72,7 +72,7 @@ const customRow = (record: IParam, index: number) => {
} }
// 表格选择功能配置 // 表格选择功能配置
const rowSelectionOption = computed(() => { const rowSelectionOption = computed(() => {
if (props.rowEditState || props.selectFirstDefault) { if (props.selectFirstDefault) {
return false; return false;
} }
return { return {
...@@ -139,19 +139,21 @@ const handleChange = (pagination: IParam, filters: IParam, sorter: IParam, data: ...@@ -139,19 +139,21 @@ const handleChange = (pagination: IParam, filters: IParam, sorter: IParam, data:
</template> </template>
{{#neq ctrl.aggMode 'NONE'}} {{#neq ctrl.aggMode 'NONE'}}
<template #summary> <template #summary>
<a-table-summary-row> <a-table-summary>
<a-table-summary-cell>数据聚合</a-table-summary-cell> <a-table-summary-row>
<a-table-summary-cell v-for="(item, index) in state.dataAgg" :key="index"> <a-table-summary-cell align="center">数据聚合</a-table-summary-cell>
<span>\{{item}}</span> <a-table-summary-cell v-for="(item, index) in state.dataAgg" :key="index">
</a-table-summary-cell> <span>\{{item}}</span>
</a-table-summary-row> </a-table-summary-cell>
</a-table-summary-row>
</a-table-summary>
</template> </template>
{{/neq}} {{/neq}}
</a-table> </a-table>
</template> </template>
<style lang="scss"> <style lang="scss">
.ibiz-grid { .ibiz-grid {
margin: 20px; height: 100%;
.table-striped { .table-striped {
background-color: #fafafa; background-color: #fafafa;
} }
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册