提交 a9af16e2 编写于 作者: Shine-zwj's avatar Shine-zwj

update:更新表格

上级 1cb602a1
{
title: "{{item.caption}}",
columnType: "{{item.columnType}}",
{{#if item.align}}
align: "{{lowerCase item.align}}",
{{/if}}
{{#if item.widthUnit 'PX'}}
width: {{item.width}},
{{else}}
minWidth: {{item.width}},
{{/if}}
resizable: true,
{{#eq item.columnType 'GROUPGRIDCOLUMN'}}
children: [
{{#each item.psDEGridColumns as | column |}}
{{>(lookup 'COLUMNMODEL') item=column}}
{{/each}}
],
{{else}}
{{#eq item.columnType 'UAGRIDCOLUMN'}}
fixed: "right",
{{/eq}}
dataIndex: "{{#if item.dataItemName}}{{lowerCase item.dataItemName}}{{else}}{{lowerCase item.codeName}}{{/if}}",
ellipsis: true,
enableSort: {{item.enableSort}},
{{#if item.aggMode}}
aggMode: "{{item.aggMode}}",
{{/if}}
{{/eq}}
},
{{#unless (or item.hideDefault item.hiddenDataItem)}}
{
title: "{{item.caption}}",
columnType: "{{item.columnType}}",
{{#if item.align}}
align: "{{lowerCase item.align}}",
{{/if}}
{{#if item.widthUnit 'PX'}}
width: {{item.width}},
{{else}}
minWidth: {{item.width}},
{{/if}}
resizable: true,
{{#eq item.columnType 'GROUPGRIDCOLUMN'}}
children: [
{{#each item.psDEGridColumns as | column |}}
{{>(lookup 'COLUMNMODEL') item=column}}
{{/each}}
],
{{else}}
{{#eq item.columnType 'UAGRIDCOLUMN'}}
fixed: "right",
{{/eq}}
dataIndex: "{{#if item.dataItemName}}{{lowerCase item.dataItemName}}{{else}}{{lowerCase item.codeName}}{{/if}}",
ellipsis: true,
enableSort: {{item.enableSort}},
{{#if item.aggMode}}
aggMode: "{{item.aggMode}}",
{{/if}}
{{/eq}}
},
{{/unless}}
{{#if (neq item.columnType 'GROUPGRIDCOLUMN')}}
<div v-if="Object.is(column.dataIndex, '{{item.codeName}}')" class="table-cell">
{{#if (eq item.columnType 'DEFGRIDCOLUMN')}}
{{#if item.enableRowEdit}}
{{>@macro/editor/include-editor.hbs}}
{{#if (eq item.columnType 'GROUPGRIDCOLUMN')}}
{{#each item.psDEGridColumns as | column |}}
{{>(lookup 'COLUMN') item=column ctrl=ctrl}}
{{/each}}
{{else}}
{{#unless (or item.hideDefault item.hiddenDataItem)}}
<div v-if="Object.is(column.dataIndex, '{{#if item.dataItemName}}{{lowerCase item.dataItemName}}{{else}}{{item.codeName}}{{/if}}')" class="table-cell">
{{#if (eq item.columnType 'DEFGRIDCOLUMN')}}
{{#if item.enableRowEdit}}
<div v-if="state.rowEditState" class="editor-cell">
{{#each ctrl.psDEGridEditItems as | editColumn | }}
{{#eq editColumn.codeName (item.codeName)}}
{{#if item.psEditor}}
{{>(lookup . 'item.psEditor.editorType') item=item ctrlType="grid"}}
{{#if (eq editColumn.codeName item.codeName)}}
{{>(lookup . 'editColumn.psEditor.editorType') item=editColumn ctrlType="grid"}}
{{/if}}
{{/eq}}
{{/each}}
</div>
<div v-else class="text-cell">
<span class="text">\{{text}}</span>
</div>
{{else}}
{{else}}
<div class="text-cell">
<span class="text">\{{text}}</span>
</div>
{{/if}}
{{else if (eq item.columnType 'UAGRIDCOLUMN')}}
<ibizToolbar
mode="link"
name="{{lowerCase item.codeName}}"
:actionModel="record.{{lowerCase item.codeName}}"
@toolbarEvent="($event) => handleToolbarEvent(record, $event)"/>
{{/if}}
{{/if}}
{{#if (eq item.columnType 'UAGRIDCOLUMN')}}
<ibizToolbar
mode="link"
name="{{lowerCase item.codeName}}"
:actionModel="record.{{lowerCase item.codeName}}"
@toolbarEvent="($event) => handleToolbarEvent(record, $event)"/>
{{/if}}
</div>
{{/unless}}
{{/if}}
{{#if (eq item.columnType 'GROUPGRIDCOLUMN')}}
{{#each item.psDEGridColumns as | column |}}
{{>(lookup 'UACOLUMNMODEL') item=column}}
{{/each}}
{{else if (eq item.columnType 'UAGRIDCOLUMN')}}
{{#each item.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, visible: true,{{#if psUIAction.psSysImage}}{{#if psUIAction.psSysImage.imagePath}} imgPath: "{{psUIAction.psSysImage.imagePath}}",{{/if}}{{#if psUIAction.psSysImage.cssClass}} iconClass: "{{psUIAction.psSysImage.cssClass}}",{{/if}}{{/if}} },
{{/action}}
{{/each}}
{{/if}}
\ No newline at end of file
{{#*inline "COLUMN"}}{{>@macro/grid-detail/grid-column.hbs}}{{/inline}}
{{#*inline "COLUMNMODEL"}}{{>@macro/grid-detail/grid-column-model.hbs}}{{/inline}}
\ No newline at end of file
{{#*inline "COLUMNMODEL"}}{{>@macro/grid-detail/grid-column-model.hbs}}{{/inline}}
{{#*inline "UACOLUMNMODEL"}}{{>@macro/grid-detail/grid-uacolumn-model.hbs}}{{/inline}}
\ No newline at end of file
import { ControlServiceBase, ControlVOBase, hasFunction } from '@ibiz-core';
/**
* @description 表格部件服务
* @export
* @class EditFormService
* @extends {ControlServiceBase<T>}
* @template T 部件数据对象类型
*/
export class GridService<T extends ControlVOBase> extends ControlServiceBase<T> {
/**
* 加载数据
*
* @param [context={}] 上下文参数
* @param [data={}] 视图参数
* @param opts
* @return {*}
*/
public async get(context: any, data: any, opts: { action: string; isLoading?: boolean }): Promise<any> {
let _entityService: any = this.entityService;
const { context: Context, data: Data } = this.handleRequestData(context, data, opts);
const action = hasFunction(_entityService, opts.action) ? opts.action : 'GET';
const response = await _entityService[action](Context, Data, opts.isLoading);
// this.setRemoteCopyData(response);
response.data = this.newControlVO(response.data);
return this.handleResponse(response, opts);
}
/**
* 创建数据
*
* @param [context={}] 上下文参数
* @param [data={}] 视图参数
* @param opts
* @return {*}
*/
public async create(context: any, data: any, opts: { action: string; isLoading?: boolean }): Promise<any> {
let _entityService: any = this.entityService;
const { context: Context, data: Data } = this.handleRequestData(context, data, opts);
const action = hasFunction(_entityService, opts.action) ? opts.action : 'Create';
const response = await _entityService[action](Context, Data, opts.isLoading);
response.data = this.newControlVO(response.data);
return this.handleResponse(response, opts);
}
/**
* 删除数据
*
* @param [context={}] 上下文参数
* @param [data={}] 视图参数
* @param opts
* @return {*}
*/
public async remove(context: any, data: any, opts: { action: string; isLoading?: boolean }): Promise<any> {
let _entityService: any = this.entityService;
const { context: Context, data: Data } = this.handleRequestData(context, data, opts);
const action = hasFunction(_entityService, opts.action) ? opts.action : 'Remove';
const response = await _entityService[action](Context, Data, opts.isLoading);
response.data = this.newControlVO(response.data);
return this.handleResponse(response, opts);
}
/**
* 更新数据
*
* @param [context={}] 上下文参数
* @param [data={}] 视图参数
* @param opts
* @return {*}
*/
public async update(context: any, data: any, opts: { action: string; isLoading?: boolean }): Promise<any> {
let _entityService: any = this.entityService;
const { context: Context, data: Data } = this.handleRequestData(context, data, opts);
const action = hasFunction(_entityService, opts.action) ? opts.action : 'Update';
const response = await _entityService[action](Context, Data, opts.isLoading);
response.data = this.newControlVO(response.data);
return this.handleResponse(response, opts);
}
}
export * from './control-service-base'
export * from './edit-form-service'
\ No newline at end of file
export * from './edit-form-service'
export * from './grid-service'
\ No newline at end of file
{{>@macro/grid-detail/include-grid.hbs}}
import { IParam } from '@ibiz-core';
import { ControlVOBase, IParam, GridService } from '@ibiz-core';
import { {{pascalCase ctrl.psAppDataEntity.codeName}}Service } from '@service/entity/{{spinalCase ctrl.psAppDataEntity.codeName}}/{{spinalCase ctrl.psAppDataEntity.codeName}}-service';
export class ControlVO extends ControlVOBase {
constructor(data: any){
super(data);
}
{{#each ctrl.psDEGridDataItems as | dataItem |}}
get {{lowerCase dataItem.name}}() {
return this.$DO.{{lowerCase dataItem.psAppDEField.codeName}};
}
set {{lowerCase dataItem.name}}(value: any) {
this.$DO.{{lowerCase dataItem.psAppDEField.codeName}} = value;
}
{{/each}}
}
export const CtrlConfig = {
controlCodeName: "{{ctrl.codeName}}",
controlName: "{{ctrl.name}}",
controlService: new GridService<ControlVO>(ControlVO, new {{pascalCase ctrl.psAppDataEntity.codeName}}Service() ),
items: [],
dataAgg: [],
selectedRowKeys: [],
......@@ -45,13 +65,7 @@ export const CtrlConfig = {
{{/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, visible: true,{{#if psUIAction.psSysImage}}{{#if psUIAction.psSysImage.imagePath}} imgPath: "{{psUIAction.psSysImage.imagePath}}",{{/if}}{{#if psUIAction.psSysImage.cssClass}} iconClass: "{{psUIAction.psSysImage.cssClass}}",{{/if}}{{/if}} },
{{/action}}
{{/each}}
{{/if}}
{{>(lookup 'UACOLUMNMODEL') item=column}}
{{/each}}
],
columnsModel: [
......@@ -69,7 +83,7 @@ export const CtrlConfig = {
{{/if}}
{{/if}}
{{#each ctrl.psDEGridColumns as | column |}}
{{>(lookup 'COLUMNMODEL') item=column}}
{{>(lookup 'COLUMNMODEL') item=column}}
{{/each}}
],
};
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册