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

update:更新表格

上级 1cb602a1
{ {{#unless (or item.hideDefault item.hiddenDataItem)}}
{
title: "{{item.caption}}", title: "{{item.caption}}",
columnType: "{{item.columnType}}", columnType: "{{item.columnType}}",
{{#if item.align}} {{#if item.align}}
...@@ -27,4 +28,5 @@ ...@@ -27,4 +28,5 @@
aggMode: "{{item.aggMode}}", aggMode: "{{item.aggMode}}",
{{/if}} {{/if}}
{{/eq}} {{/eq}}
}, },
{{/unless}}
{{>@macro/editor/include-editor.hbs}}
{{#if (neq item.columnType 'GROUPGRIDCOLUMN')}} {{#if (eq item.columnType 'GROUPGRIDCOLUMN')}}
<div v-if="Object.is(column.dataIndex, '{{item.codeName}}')" class="table-cell"> {{#each item.psDEGridColumns as | column |}}
{{#if (eq item.columnType 'DEFGRIDCOLUMN')}} {{>(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}} {{#if item.enableRowEdit}}
<div v-if="state.rowEditState" class="editor-cell"> <div v-if="state.rowEditState" class="editor-cell">
{{#each ctrl.psDEGridEditItems as | editColumn | }} {{#each ctrl.psDEGridEditItems as | editColumn | }}
{{#eq editColumn.codeName (item.codeName)}} {{#if (eq editColumn.codeName item.codeName)}}
{{#if item.psEditor}} {{>(lookup . 'editColumn.psEditor.editorType') item=editColumn ctrlType="grid"}}
{{>(lookup . 'item.psEditor.editorType') item=item ctrlType="grid"}}
{{/if}} {{/if}}
{{/eq}}
{{/each}} {{/each}}
</div> </div>
<div v-else class="text-cell"> <div v-else class="text-cell">
...@@ -20,13 +23,13 @@ ...@@ -20,13 +23,13 @@
<span class="text">\{{text}}</span> <span class="text">\{{text}}</span>
</div> </div>
{{/if}} {{/if}}
{{/if}} {{else if (eq item.columnType 'UAGRIDCOLUMN')}}
{{#if (eq item.columnType 'UAGRIDCOLUMN')}} <ibizToolbar
<ibizToolbar
mode="link" mode="link"
name="{{lowerCase item.codeName}}" name="{{lowerCase item.codeName}}"
:actionModel="record.{{lowerCase item.codeName}}" :actionModel="record.{{lowerCase item.codeName}}"
@toolbarEvent="($event) => handleToolbarEvent(record, $event)"/> @toolbarEvent="($event) => handleToolbarEvent(record, $event)"/>
{{/if}} {{/if}}
</div> </div>
{{/unless}}
{{/if}} {{/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 "COLUMN"}}{{>@macro/grid-detail/grid-column.hbs}}{{/inline}}
{{#*inline "COLUMNMODEL"}}{{>@macro/grid-detail/grid-column-model.hbs}}{{/inline}} {{#*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 './control-service-base'
export * from './edit-form-service' export * from './edit-form-service'
export * from './grid-service'
\ No newline at end of file
{{>@macro/grid-detail/include-grid.hbs}} {{>@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 = { export const CtrlConfig = {
controlCodeName: "{{ctrl.codeName}}", controlCodeName: "{{ctrl.codeName}}",
controlName: "{{ctrl.name}}", controlName: "{{ctrl.name}}",
controlService: new GridService<ControlVO>(ControlVO, new {{pascalCase ctrl.psAppDataEntity.codeName}}Service() ),
items: [], items: [],
dataAgg: [], dataAgg: [],
selectedRowKeys: [], selectedRowKeys: [],
...@@ -45,13 +65,7 @@ export const CtrlConfig = { ...@@ -45,13 +65,7 @@ export const CtrlConfig = {
{{/if}} {{/if}}
uAColumnModel:[ uAColumnModel:[
{{#each ctrl.psDEGridColumns as | column |}} {{#each ctrl.psDEGridColumns as | column |}}
{{#if (eq column.columnType 'UAGRIDCOLUMN')}} {{>(lookup 'UACOLUMNMODEL') item=column}}
{{#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}}
{{/each}} {{/each}}
], ],
columnsModel: [ columnsModel: [
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册