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

update:更新表格部件

支持代码表分组
操作列呈现
上级 0e89d33b
<div v-if="Object.is(column.dataIndex, '{{#if item.dataItemName}}{{lowerCase item.dataItemName}}{{else}}{{item.codeName}}{{/if}}')" class="header-cell">
<div v-if="Object.is(column.dataIndex, '{{#if item.dataItemName}}{{lowerCase item.dataItemName}}{{else}}{{item.codeName}}{{/if}}')" class="header-cell{{#if item.headerPSSysCss}} {{item.headerPSSysCss.cssName}}{{/if}}">
{{#if item.psSysImage}}
<AppIconText {{#if item.psSysImage.cssClass}}iconClass="{{item.psSysImage.cssClass}}"{{/if}} {{#if item.psSysImage.imagePath}}imgPath="{{item.psSysImage.imagePath}}"{{/if}}/>
<span class="title">\{{title}}</span>
......
{{#unless (or item.hideDefault item.hiddenDataItem)}}
{
{
title: "{{item.caption}}",
columnType: "{{item.columnType}}",
{{#if item.align}}
......@@ -28,5 +28,5 @@
aggMode: "{{item.aggMode}}",
{{/if}}
{{/eq}}
},
},
{{/unless}}
......@@ -4,7 +4,7 @@
{{/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">
<div v-if="Object.is(column.dataIndex, '{{#if item.dataItemName}}{{lowerCase item.dataItemName}}{{else}}{{item.codeName}}{{/if}}')" class="table-cell {{#if item.cellPSSysCss}} {{item.cellPSSysCss.cssName}}{{/if}}">
{{#if (eq item.columnType 'DEFGRIDCOLUMN')}}
{{#if item.enableRowEdit}}
<div v-if="state.rowEditState" class="editor-cell">
......
......@@ -3,9 +3,11 @@
{{> @macro/front-end/widgets/grid-detail/include-grid.hbs type="UACOLUMNMODEL" item=column}}
{{/each}}
{{else if (eq item.columnType 'UAGRIDCOLUMN')}}
{{lowerCase item.codeName}}: [
{{#each item.psDEUIActionGroup.psUIActionGroupDetails as | action |}}
{{#action}}
{ name: "{{name}}", caption: "{{psUIAction.caption}}", showIcon: {{showIcon}}, showCaption: {{showCaption}}, separator: {{addSeparator}}, uIActionTag: "{{psUIAction.uIActionTag}}", noPrivDisplayMode: "{{psUIAction.noPrivDisplayMode}}", dataAccessAction: '{{psUIAction.dataAccessAction}}', actionTarget: '{{psUIAction.actionTarget}}', 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
......@@ -27,7 +27,7 @@ export interface GridControlState extends MDControlState {
* @type {IParam}
* @memberof GridControlState
*/
uAColumnModel: IParam[];
uAColumnModel: IParam;
/**
* @description 值规则
......
import { DataTypes, dateFormat, deepCopy, GridControlState, IActionParam, IParam, MDControl } from "@core";
import { DataTypes, dateFormat, deepCopy, GridControlState, IActionParam, IParam, isExistAndNotEmpty, MDControl } from "@core";
import { createUUID } from "qx-util";
import schema, { ErrorList, FieldErrorList } from 'async-validator';
/**
......@@ -220,8 +220,15 @@ export class GridControl extends MDControl {
*/
public handleStateChange() {
// 计算表格操作列行为权限
const { items, columnsModel } = toRefs(this.state);
// this.getActionAuthState
const { items, uAColumnModel } = toRefs(this.state);
if (items.value.length > 0 && uAColumnModel.value && Object.keys(uAColumnModel.value).length > 0) {
Object.keys(uAColumnModel.value).forEach((key: string) => {
const tempActionModel = uAColumnModel.value[key];
items.value.forEach((item: any) => {
Object.assign(item, { [key]: this.getActionAuthState(item, tempActionModel) });
});
})
}
// 处理分组
this.handleDataGroup();
// 处理数据聚合
......@@ -405,44 +412,60 @@ export class GridControl extends MDControl {
* @protected
* @memberof MDControl
*/
protected codeListGroupData() {
const { gridGroup } = this.state;
const { items, columnsModel } = toRefs(this.state);
const { groupField } = gridGroup;
// TODO 代码表数据
let codeListGroup: IParam[] = [];
if (codeListGroup.length > 0) {
protected async codeListGroupData() {
const { groupField, groupCodeList } = this.state.mdCtrlGroup;
const { items, context, viewParams, columnsModel } = toRefs(this.state);
if (!groupCodeList || !isExistAndNotEmpty(groupCodeList.codeListTag)) {
App.getNotificationService().warning({
message: '警告',
description: '未配置分组代码表'
});
return;
}
const codeListService = App.getCodeListService();
let codeListItems: IParam[] = [];
try {
codeListItems = await codeListService.getCodeListItems({
tag: groupCodeList.codeListTag,
context,
viewParams
});
} catch(error) {
console.warn(`分组代码表 ${groupCodeList.codeListTag} 获取数据项异常`);
}
// 分组列
const groupColumn = this.getGridColumn(columnsModel.value, "GROUP");
const gridData: IParam[] = [];
const otherGroup: IParam[] = [];
codeListGroup.forEach((group: IParam) => {
// 分组数据集合
const groupItems: IParam[] = [];
// 其他分组项
const otherGroupItems: IParam[] = [];
codeListItems.forEach((group: IParam) => {
const children: IParam[] = [];
items.value.forEach((item: IParam) => {
if (Object.is(group.value, item[groupField])) {
children.push(item);
}
});
gridData.push({
groupItems.push({
srfkey: createUUID(),
[groupColumn.dataIndex]: group.text,
children: deepCopy(children),
children: children
})
});
items.value.forEach((item: IParam) => {
const index: number = codeListGroup.findIndex((_item: IParam) => Object.is(item[groupField], _item.value));
const index: number = codeListItems.findIndex((_item: IParam) => Object.is(item[groupField], _item.value));
if (index < 0) {
otherGroup.push(item);
otherGroupItems.push(item);
}
});
if (otherGroup.length > 0) {
gridData.push({
if (otherGroupItems.length > 0) {
groupItems.push({
srfkey: createUUID(),
[groupColumn.dataIndex]: "其它",
children: deepCopy(otherGroup),
children: otherGroupItems,
})
}
items.value = gridData;
}
this.state.items = [...groupItems];
}
/**
......
......@@ -32,20 +32,6 @@ export class MainControl extends ControlBase {
this.state.controlAction = toRef(this.props, 'controlAction') as any;
}
/**
* 获取指定数据的操作权限
*
* @param {IParam} data 指定数据
* @param {IParam} actionModel 界面行为模型
* @memberof MainControl
*/
public async getActionAuthState(data: IParam, actionModel: IParam) {
const { context, appEntityCodeName } = this.state;
const tempUIservice = await App.getUIService(appEntityCodeName.toLowerCase(), context);
UIUtil.calcActionItemAuthState(data, actionModel, tempUIservice);
return actionModel;
}
/**
*@description 使用UI服务
*
......
import { MDControlState, MainControl, deepCopy, IActionParam, IParam, UIBase } from '@core';
import { MDControlState, MainControl, deepCopy, IActionParam, IParam, UIBase, isExistAndNotEmpty, UIUtil } from '@core';
import { Modal } from 'ant-design-vue';
/**
* @description 多数据部件
......@@ -444,6 +445,18 @@ export class MDControl extends MainControl {
*/
protected setUpdateDefault(): void { }
/**
* 获取指定数据的操作权限
*
* @param {IParam} data 指定数据
* @memberof MDControl
*/
public getActionAuthState(data: IParam, tempActionModel: IParam) {
const { UIService } = toRefs(this.state);
UIUtil.calcActionItemAuthState(data, tempActionModel, UIService);
return tempActionModel;
}
/**
* 获取当前激活数据
*
......
......@@ -55,7 +55,7 @@ export const ctrlState = {
groupField: "{{lowerCase ctrl.groupPSAppDEField.codeName}}",
{{#if ctrl.groupPSCodeList}}
groupCodeList: {
codeListTag: "{{ctrl.groupPSCodeList.codeName}}",
codeListTag: "{{ctrl.groupPSCodeList.codeListTag}}",
codeListType: "{{ctrl.groupPSCodeList.codeListType}}",
},
{{/if}}
......@@ -87,11 +87,11 @@ export const ctrlState = {
aggDataSet: "{{ctrl.aggPSAppDEDataSet.codeName}}",
{{/if}}
},
uAColumnModel:[
uAColumnModel: {
{{#each ctrl.psDEGridColumns as | column |}}
{{> @macro/front-end/widgets/grid-detail/include-grid.hbs type="UACOLUMNMODEL" item=column}}
{{/each}}
],
},
gridEditState:{
{{#each ctrl.psDEGridEditItems as | column |}}
{{#if column.codeName }}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册