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

update:新增列表界面行为绘制支持

上级 cad9386e
import { IParam } from "@core";
import { MDControlState } from "../md-control";
/**
......@@ -7,5 +8,10 @@ import { MDControlState } from "../md-control";
* @extends {MDControl}
*/
export interface ListControlState extends MDControlState {
/**
* @description 界面行为集合
* @type {IParam[]}
* @memberof ListControlState
*/
uIActions: IParam[];
}
\ No newline at end of file
import { IParam } from "@core";
import { MDControl } from "../md-control";
/**
......@@ -8,6 +9,17 @@ import { MDControl } from "../md-control";
*/
export class ListControl extends MDControl {
/**
* @description 触发界面行为
* @protected
* @param {IParam} action 界面行为
* @param {MouseEvent} event 鼠标源事件
* @memberof ListControl
*/
protected onUIAction(action: IParam, event: MouseEvent) {
console.log(action, event);
}
/**
* @description 安装部件所有功能模块的方法
* @return {*}
......@@ -17,6 +29,7 @@ export class ListControl extends MDControl {
const superParams = super.moduleInstall();
return {
...superParams,
onUIAction: this.onUIAction.bind(this)
}
}
......
.app-list {
.list-item__action {
color: #2d8cf0;
cursor: pointer;
&:not(:first-child) {
padding-left: 12px;
}
i, img {
padding-right: 6px;
}
}
.list-item__action.disabled {
color: #d2d2d2;
cursor: no-drop;
}
}
\ No newline at end of file
......@@ -7,4 +7,5 @@
@use './app-tab-view-panel.scss';
@use './app-portlet.scss';
@use './app-grid.scss';
@use './app-tree.scss';
\ No newline at end of file
@use './app-tree.scss';
@use './app-list.scss';
\ No newline at end of file
import { ControlVOBase, IParam, ListService, isEmpty, Verify } from '@core';
import { {{pascalCase ctrl.psAppDataEntity.codeName}}Service } from '@api/{{spinalCase
ctrl.psAppDataEntity.codeName}}/{{spinalCase ctrl.psAppDataEntity.codeName}}-service';
import { {{pascalCase ctrl.psAppDataEntity.codeName}}Service } from '@api/{{spinalCase ctrl.psAppDataEntity.codeName}}/{{spinalCase ctrl.psAppDataEntity.codeName}}-service';
export class ControlVO extends ControlVOBase {
constructor(data: any){
super(data);
// 列表自持属性
this.$ownKeys =
{{~#each ctrl.psDEListDataItems as | dataItem | ~}}
{{#if @first}}[{{/if~}}
'{{lowerCase dataItem.name}}'{{#unless @last}},{{/unless}}
{{~#if @last}}];{{/if~}}
{{/each}}
}
{{#each ctrl.psDEListDataItems as | dataItem |}}
{{#if dataItem.psAppDEField}}
get {{lowerCase dataItem.name}}() {
return this.$DO.{{lowerCase dataItem.psAppDEField.codeName}};
}
set {{lowerCase dataItem.name}}(value: any) {
this.$DO.{{lowerCase dataItem.psAppDEField.codeName}} = value;
}
{{/if}}
{{/each}}
}
export const ctrlState = {
......@@ -38,4 +59,20 @@ export const ctrlState = {
current: 1,
pageSize: {{#if ctrl.pagingSize}}{{ctrl.pagingSize}}{{else}}20{{/if}}
},
// 界面行为
uIActions: {
{{#each ctrl.psDEListItems as | listItem |}}
{{#and listItem.psDEUIActionGroup listItem.psDEUIActionGroup.psUIActionGroupDetails}}
{{#listItem}}
{{#each psDEUIActionGroup.psUIActionGroupDetails as | uiActionDetail |}}
{{#if uiActionDetail.getPSUIAction}}
{{#uiActionDetail.getPSUIAction}}
{{uIActionTag}}: { caption: '{{caption}}', tooltip: '{{tooltip}}', showCaption: {{../showCaption}}, showIcon: {{../showIcon}}, uIActionTag: '{{uIActionTag}}', uIActionType: '{{uIActionType}}', dataAccessAction: '{{dataAccessAction}}', noPrivDisplayMode: '{{noPrivDisplayMode}}', uIActionMode: '{{uIActionMode}}', disabled: false, visible: true, {{#if coutnerId}}counterId: '{{counterId}}', {{/if}}{{#if psSysImage}}cssClass: '{{psSysImage.cssClass}}', {{#if psSysImage.cssClass}}{{/if}}{{#if psSysImage.imagePath}}imagePath: '{{psSysImage.imagePath}}'{{/if}}{{/if}} },
{{/uiActionDetail.getPSUIAction}}
{{/if}}
{{/each}}
{{/listItem}}
{{/and}}
{{/each}}
}
}
\ No newline at end of file
......@@ -35,25 +35,48 @@ interface CtrlEmit {
const emit = defineEmits<CtrlEmit>();
// 安装功能模块,提供状态和能力
const { name, state, useCustom, onEditorEvent, onToolbarEvent, onActionColEvent, newRow, remove, save, load, refresh, getData, exportExcel } = new ListControl(ctrlState, props, emit).moduleInstall();
const { name, state, onUIAction, newRow, remove, save, load, refresh, getData, xDataCtrl, exportExcel } = new ListControl(ctrlState, props, emit).moduleInstall();
// 暴露内部状态及能力
defineExpose({ name, state, newRow, remove, save, load, refresh, getData, exportExcel });
</script>
<template>
<a-list
item-layout="horizontal"
:data-source="state.items">
<template #renderItem="{ item }">
<a-list-item>
<template #title>
2321
</template>
</a-list-item>
<a-list
ref="xDataCtrl"
class="app-list{{#if ctrl.psSysCss}} {{ctrl.psSysCss.cssName}}{{/if}}"
item-layout="horizontal"
:data-source="state.items">
<template #renderItem="{ item }">
<a-list-item class="app-list-item">
<a-list-item-meta
:description="item.srfdescription">
<template #title>
<span class="text">\{{item.srfmajortext}}</span>
</template>
<template v-if="item.srficon">
<img :src="item.srficon" />
</template>
</a-list-item-meta>
<template #actions v-if="state.uIActions">
<div class="list-item__actions">
<template v-for="(action, index) of state.uIActions" :key="index">
<span
v-if="action.visible"
:class="['list-item__action', action.disabled ? 'disabled' : '']"
:title="action.tooltip ? action.tooltip : action.caption"
@click="(event) => onUIAction(action, event)">
<template v-if="action.showIcon">
<i v-if="action.cssClass" :class="action.cssClass" />
<img v-if="action.imagePath" :src="action.imagePath" />
</template>
<span v-if="action.showCaption" class="text">\{{action.caption}}</span>
</span>
</template>
</div>
</template>
</a-list>
</a-list-item>
</template>
</a-list>
</template>
<style lang="scss">
.app-list {
}
</style>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册