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

update:更新

上级 6591a538
{
title: "{{item.caption}}",
columnType: "{{item.columnType}}",
{{#neq lastColumn true}}
{{#if item.widthUnit 'PX'}}
width: {{item.width}},
......
......@@ -13,14 +13,14 @@ export interface GridControlState extends MainControlState {
* @type {IParam[]}
* @memberof GridControlState
*/
Items: IParam[];
items: IParam[];
/**
* @description 表格列模型
* @type {IParam}
* @memberof GridControlState
*/
columnsModel: IParam;
columnsModel: IParam[];
/**
* @description 表格界面行为模型
......@@ -72,11 +72,11 @@ export interface GridControlState extends MainControlState {
selectFirstDefault: boolean;
/**
* @description 数据总条数
* @description 分页大小
* @type {number}
* @memberof GridControlState
*/
total: number;
pageSize: number;
/**
* @description 是否启用分页
......
import { deepCopy, GridControlProps, GridControlState, IActionParam, MainControl } from '@ibiz-core';
import { calcActionItemAuthState, deepCopy, GridControlProps, GridControlState, IActionParam, IParam, MainControl } from '@ibiz-core';
/**
* @description 表格部件
......@@ -40,6 +40,61 @@ export class GridControl extends MainControl {
this.controlState.items[rowIndex][name] = value;
}
/**
* @description 获取界面行为权限状态
* @param {IParam} rowData 行数据
* @return {*}
* @memberof GridControl
*/
public getActionAuthState(rowData: IParam) {
const { UIService, actionModel } = this.controlState;
let tempActionModel: any = deepCopy(actionModel);
calcActionItemAuthState(rowData, tempActionModel, UIService);
return tempActionModel;
}
/**
* @description 获取操作列标识
* @param {IParam} column 表格列集合
* @memberof GridControl
*/
public getUAGridColumn(columns: IParam[]): any {
columns.forEach((column: IParam) => {
if (Object.is(column.columnType, "UAGRIDCOLUMN")) {
return column.dataIndex;
}
if (column.children?.length > 0) {
return this.getUAGridColumn(column.children);
}
})
}
/**
* @description 计算表格行为权限
* @memberof GridControl
*/
public calcGridAuthState() {
const dataRef = toRef(this.controlState, 'items');
const columnsModelRef = toRef(this.controlState, 'columnsModel');
let uaColumnKey = this.getUAGridColumn(columnsModelRef.value);
if (uaColumnKey) {
dataRef.value.forEach((item: IParam) => {
Object.assign(item, {
[uaColumnKey]: this.getActionAuthState(item),
})
})
}
}
/**
* @description 处理表格分组
* @memberof GridControl
*/
public handleGridGroup() {
const { groupMode, groupField, groupCodeList } = this.controlState;
}
/**
* @description 使用加载功能模块
* @param {GridControlProps} props 传入的props
......@@ -51,24 +106,40 @@ export class GridControl extends MainControl {
const load = async (opt: any = {})=>{
try {
const loadAction = this.controlState.controlAction.loadAction;
const { controlService, context, viewParams, showBusyIndicator } = this.controlState;
const {
controlService, context, viewParams, showBusyIndicator, noSort, minorSortDir, minorSortPSDEF,
enablePagingBar, pageSize
} = this.controlState;
const dataRef = toRef(this.controlState, 'items');
const paginationRef = toRef(this.controlState, 'pagination');
if(!loadAction){
return;
}
let _context = deepCopy(context);
let _viewParams = deepCopy(viewParams);
if (noSort && minorSortDir && minorSortPSDEF) {
Object.assign(_viewParams, { sort: `${minorSortPSDEF},${minorSortDir}`});
}
if (enablePagingBar) {
if (opt.current && opt.pageSize) {
Object.assign(_viewParams, { page: opt.current - 1, size: opt.pageSize});
} else {
Object.assign(_viewParams, { page: 0, size: pageSize});
}
}
const response = await controlService.get(loadAction, _context, {viewParams: _viewParams}, showBusyIndicator );
if (!response.status || response.status !== 200) {
return
}
dataRef.value = response.data;
if (enablePagingBar) {
paginationRef.value['total'] = response.total;
}
this.calcGridAuthState();
this.handleGridGroup();
} catch (error) {
// todo 错误异常处理
}
}
// 订阅viewSubject,监听load行为
......@@ -114,7 +185,7 @@ export class GridControl extends MainControl {
*/
public moduleInstall(props: GridControlProps, emit?: Function) {
const superParams = super.moduleInstall(props, emit);
const { load } = this.useLoad(props)
const { load } = this.useLoad(props);
const handleEditorEvent = this.handleEditorEvent.bind(this);
this.handleEditorEvent = (rowIndex: number,actionParam: IActionParam) => {
......
......@@ -7,9 +7,9 @@ export const ViewConfig = {
{{lowerCase codeName}}:{
name:'{{name}}',
items:[
{{#pSDEToolbarItems}}
{{#psDEToolbarItems}}
{ name:'{{name}}',caption:'{{caption}}',groupExtractMode:'{{groupExtractMode}}',itemType:'{{itemType}}',noPrivDisplayMode:'{{noPrivDisplayMode}}',showIcon:{{showIcon}},showCaption:{{showCaption}},tooltip:'{{tooltip}}' },
{{/pSDEToolbarItems}}
{{/psDEToolbarItems}}
]
},
{{/eq}}
......
......@@ -11,67 +11,67 @@ const routes = [
caption: "{{app.defaultPSAppIndexView.caption}}",
viewType: "{{app.defaultPSAppIndexView.viewType}}",
dynaModelFilePath: "{{app.defaultPSAppIndexView.dynaModelFilePath}}",
{{#if app.defaultPSAppIndexView.pSSysImage}}
imgPath: "{{app.defaultPSAppIndexView.pSSysImage.ImagePath}}",
iconCls: "{{app.defaultPSAppIndexView.pSSysImage.cssClass}}",
{{#if app.defaultPSAppIndexView.psSysImage}}
imgPath: "{{app.defaultPSAppIndexView.psSysImage.imagePath}}",
iconCls: "{{app.defaultPSAppIndexView.psSysImage.cssClass}}",
{{/if}}
parameters: [
{ pathName: "views", parameterName: "{{lowerCase app.defaultPSAppIndexView.codeName}}" },
],
requireAuth: {{#eq app.defaultPSAppIndexView.accUserMode 0}}false{{else}}{{#eq app.defaultPSAppIndexView.accUserMode 3}}false{{else}}true{{/eq}}{{/eq}},
},
component: () => import("@page/{{#if app.defaultPSAppIndexView.pSAppDataEntity}}{{spinalCase app.defaultPSAppIndexView.pSAppDataEntity.codeName}}{{else}}default{{/if}}/{{spinalCase app.defaultPSAppIndexView.codeName}}/{{spinalCase app.defaultPSAppIndexView.codeName}}.vue"),
component: () => import("@page/{{#if app.defaultPSAppIndexView.psAppDataEntity}}{{spinalCase app.defaultPSAppIndexView.psAppDataEntity.codeName}}{{else}}default{{/if}}/{{spinalCase app.defaultPSAppIndexView.codeName}}/{{spinalCase app.defaultPSAppIndexView.codeName}}.vue"),
children: [
{{#each app.allPSAppViews as | appView |}}
{{!-- 实体视图 --}}
{{#if appView.pSAppDataEntity}}
{{#if appView.psAppDataEntity}}
{{!-- 多重路径 --}}
{{#if appView.pSAppDataEntity.pSAppDERSPathCount}}
{{#if appView.psAppDataEntity.psAppDERSPathCount}}
{{#if (or (eq appView.viewType 'DEEDITVIEW') (eq appView.viewType 'DEGRIDVIEW'))}}
{
path: "{{lowerCase (pluralize appView.pSAppDataEntity.codeName)}}/:{{lowerCase codeName}}?/views/:view?",
path: "{{lowerCase (pluralize appView.psAppDataEntity.codeName)}}/:{{lowerCase codeName}}?/views/:view?",
meta: {
captionTag: "{{#if appView.capPSLanguageRes}}{{appView.capPSLanguageRes.lanResTag}}{{/if}}",
caption: "{{appView.caption}}",
viewType: "{{appView.viewType}}",
info:'',
{{#if appView.pSSysImage}}
imgPath: "{{appView.pSSysImage.ImagePath}}",
iconCls: "{{appView.pSSysImage.cssClass}}",
{{#if appView.psSysImage}}
imgPath: "{{appView.psSysImage.imagePath}}",
iconCls: "{{appView.psSysImage.cssClass}}",
{{/if}}
parameters: [
{ pathName: "{{lowerCase app.defaultPSAppIndexView.codeName}}", parameterName: "{{lowerCase app.defaultPSAppIndexView.codeName}}" },
{ pathName: "{{lowerCase (pluralize appView.pSAppDataEntity.codeName)}}", parameterName: "{{lowerCase codeName}}" },
{ pathName: "{{lowerCase (pluralize appView.psAppDataEntity.codeName)}}", parameterName: "{{lowerCase codeName}}" },
{ pathName: 'views', parameterName: 'view' },
],
resource: "{{entity.codeName.lowerCase}}",
requireAuth: false,
},
component: () => import("@page/{{#if appView.pSAppDataEntity}}{{spinalCase appView.pSAppDataEntity.codeName}}{{else}}default{{/if}}/{{spinalCase appView.codeName}}/{{spinalCase appView.codeName}}.vue"),
component: () => import("@page/{{#if appView.psAppDataEntity}}{{spinalCase appView.psAppDataEntity.codeName}}{{else}}default{{/if}}/{{spinalCase appView.codeName}}/{{spinalCase appView.codeName}}.vue"),
},
{{/if}}
{{else}}
{{#if (or (eq appView.viewType 'DEEDITVIEW') (eq appView.viewType 'DEGRIDVIEW'))}}
{
path: "{{lowerCase (pluralize appView.pSAppDataEntity.codeName)}}/:{{lowerCase codeName}}?/views/:view?",
path: "{{lowerCase (pluralize appView.psAppDataEntity.codeName)}}/:{{lowerCase codeName}}?/views/:view?",
meta: {
captionTag: "{{#if appView.capPSLanguageRes}}{{appView.capPSLanguageRes.lanResTag}}{{/if}}",
caption: "{{appView.caption}}",
viewType: "{{appView.viewType}}",
info:'',
{{#if appView.pSSysImage}}
imgPath: "{{appView.pSSysImage.ImagePath}}",
iconCls: "{{appView.pSSysImage.cssClass}}",
{{#if appView.psSysImage}}
imgPath: "{{appView.psSysImage.imagePath}}",
iconCls: "{{appView.psSysImage.cssClass}}",
{{/if}}
parameters: [
{ pathName: "{{lowerCase app.defaultPSAppIndexView.codeName}}", parameterName: "{{lowerCase app.defaultPSAppIndexView.codeName}}" },
{ pathName: "{{lowerCase (pluralize appView.pSAppDataEntity.codeName)}}", parameterName: "{{lowerCase appView.pSAppDataEntity.codeName}}" },
{ pathName: "{{lowerCase (pluralize appView.psAppDataEntity.codeName)}}", parameterName: "{{lowerCase appView.psAppDataEntity.codeName}}" },
{ pathName: 'views', parameterName: 'view' },
],
resource: "{{entity.codeName.lowerCase}}",
requireAuth: false,
},
component: () => import("@page/{{#if appView.pSAppDataEntity}}{{spinalCase appView.pSAppDataEntity.codeName}}{{else}}default{{/if}}/{{spinalCase appView.codeName}}/{{spinalCase appView.codeName}}.vue"),
component: () => import("@page/{{#if appView.psAppDataEntity}}{{spinalCase appView.psAppDataEntity.codeName}}{{else}}default{{/if}}/{{spinalCase appView.codeName}}/{{spinalCase appView.codeName}}.vue"),
},
{{/if}}
{{/if}}
......@@ -84,9 +84,9 @@ const routes = [
caption: "{{appView.caption}}",
viewType: "{{appView.viewType}}",
info:'',
{{#if appView.pSSysImage}}
imgPath: "{{appView.pSSysImage.ImagePath}}",
iconCls: "{{appView.pSSysImage.cssClass}}",
{{#if appView.psSysImage}}
imgPath: "{{appView.psSysImage.imagePath}}",
iconCls: "{{appView.psSysImage.cssClass}}",
{{/if}}
parameters: [
{ pathName: "{{lowerCase app.defaultPSAppIndexView.codeName}}", parameterName: "{{lowerCase app.defaultPSAppIndexView.codeName}}" },
......@@ -94,7 +94,7 @@ const routes = [
],
requireAuth: false,
},
component: () => import("@page/{{#if appView.pSAppDataEntity}}{{spinalCase appView.pSAppDataEntity.codeName}}{{else}}default{{/if}}/{{spinalCase appView.codeName}}/{{spinalCase appView.codeName}}.vue"),
component: () => import("@page/{{#if appView.psAppDataEntity}}{{spinalCase appView.psAppDataEntity.codeName}}{{else}}default{{/if}}/{{spinalCase appView.codeName}}/{{spinalCase appView.codeName}}.vue"),
},
{{/neq}}
{{/if}}
......
......@@ -31,8 +31,8 @@ export class {{appEntity.codeName.pascalCase}}ServiceBase extends EntityService
*/
async {{singleAppMethod.codeName}}(_context: any = {}, _data: any = {}): Promise<any> {
//{{singleAppMethod}}
//{{singleAppMethod.pSDEServiceAPIMethod}}
//{{singleAppMethod.pSDEServiceAPIMethod.requestMethod}}
//{{singleAppMethod.psDEServiceAPIMethod}}
//{{singleAppMethod.psDEServiceAPIMethod.requestMethod}}
{{#eq singleAppMethod.methodType "SELECT" }}
const res = await this.http.post(`/{{appEntity.codeName.pluralize}}/${encodeURIComponent(_context.{{appEntity.codeName.lowerCase}})}{{singleAppMethod.requestPath}}`, _data);
return res;
......
......@@ -5,7 +5,7 @@ export const CtrlConfig = {
defaultOpens: [],
defaultSelect: [],
menus: [
{{#each ctrl.pSAppMenuItems as | item |}}
{{#each ctrl.psAppMenuItems as | item |}}
{{>(lookup 'MENUITEM') item=item}}
{{/each}}
],
......
......@@ -15,24 +15,24 @@ export const CtrlConfig = {
*/
export class ControlVO extends ControlVOBase {
// 表单里映射了属性的字段
{{#each ctrl.pSDEFormItems as | formItem | }}
{{#each ctrl.psDEFormItems as | formItem | }}
{{!-- // 表单formItem
{{formItem.name}}
{{formItem.id}} --}}
{{#neq formItem.pSAppDEField null }}
{{#neq formItem.psAppDEField null }}
get {{lowerCase formItem.id}}() {
return this.$DO.{{lowerCase formItem.pSAppDEField.codeName}};
return this.$DO.{{lowerCase formItem.psAppDEField.codeName}};
}
set {{lowerCase formItem.id}}(value: any) {
this.$DO.{{lowerCase formItem.pSAppDEField.codeName}} = value;
this.$DO.{{lowerCase formItem.psAppDEField.codeName}} = value;
}
{{/neq}}
{{/each}}
// 表单里没有映射实体属性的字段
{{#each ctrl.pSDEFormItems as | formItem | }}
{{#eq formItem.pSAppDEField null }}
{{#each ctrl.psDEFormItems as | formItem | }}
{{#eq formItem.psAppDEField null }}
{{lowerCase formItem.id}}: any;
{{/eq}}
{{/each}}
......
import { ControlServiceBase } from '@ibiz-core';
import { {{pascalCase ctrl.pSAppDataEntity.codeName}}Service } from '@service/{{spinalCase ctrl.pSAppDataEntity.codeName}}/{{spinalCase ctrl.pSAppDataEntity.codeName}}-service';
import { {{pascalCase ctrl.psAppDataEntity.codeName}}Service } from '@service/{{spinalCase ctrl.psAppDataEntity.codeName}}/{{spinalCase ctrl.psAppDataEntity.codeName}}-service';
import { ControlVO } from './{{ctrl.codeName.lowerCase}}-form-config';
export class ControlService extends ControlServiceBase {
......@@ -7,7 +7,7 @@ export class ControlService extends ControlServiceBase {
/**
* 实体服务对象
*/
public entityService: {{pascalCase ctrl.pSAppDataEntity.codeName}}Service = new {{pascalCase ctrl.pSAppDataEntity.codeName}}Service();
public entityService: {{pascalCase ctrl.psAppDataEntity.codeName}}Service = new {{pascalCase ctrl.psAppDataEntity.codeName}}Service();
/**
* 加载数据
......
......@@ -31,13 +31,13 @@ const { state, handleEditorEvent } = new FormControl(CtrlConfig).moduleInstall(p
<template>
<a-form
name="{{ctrl.codeName}}"
class="ibiz-form{{#if ctrl.pSSysCss}} {{ctrl.pSSysCss.cssName}}{{/if}}{{#if ctrl.infoFormMode}} ibiz-info-form{{/if}}"
class="ibiz-form{{#if ctrl.psSysCss}} {{ctrl.psSysCss.cssName}}{{/if}}{{#if ctrl.infoFormMode}} ibiz-info-form{{/if}}"
style="{{#if ctrl.formWidth}}width: {{ctrl.formWidth}}px;{{/if}}"
:model="state.data"
:rules="state.rules">
{{#if ctrl.noTabHeader}}
{{#each ctrl.psDEFormPages as | ctrlPage | }}
{{#each ctrlPage.pSDEFormDetails as | formDetail | }}
{{#each ctrlPage.psDEFormDetails as | formDetail | }}
{{>(lookup . 'formDetail.detailType') item=formDetail}}
{{/each }}
{{/each}}
......
......@@ -4,8 +4,8 @@ export const CtrlConfig = {
controlCodeName: "{{ctrl.codeName}}",
controlName: "{{ctrl.name}}",
items: [],
total: 0,
aggMode: "{{ctrl.aggMode}}",
{{#if ctrl.enableGroup}}
groupMode: "{{ctrl.groupMode}}",
groupField: "{{ctrl.groupPSAppDEField.codeName}}",
{{#if ctrl.groupPSCodeList}}
......@@ -14,18 +14,20 @@ export const CtrlConfig = {
codeListType: "{{ctrl.groupPSCodeList.codeListType}}",
},
{{/if}}
{{/if}}
{{#if ctrl.noSort}}
noSort: true,
{{else}}
noSort: false,
minorSortDir: "{{#if ctrl.minorSortDir}}{{ctrl.minorSortDir}}{{else}}ASC{{/if}}",
minorSortDir: "{{#if ctrl.minorSortDir}}{{ctrl.minorSortDir}}{{/if}}",
minorSortPSDEF: "{{ctrl.minorSortPSAppDEField.codeName}}",
{{/if}}
{{#if ctrl.enablePagingBar}}
enablePagingBar: true,
pageSize: {{#if ctrl.pagingSize}}{{ctrl.pagingSize}}{{else}}20{{/if}},
pagination: {
position: ['bottomRight'],
defaultPageSize: {{ctrl.pagingSize}},
defaultPageSize: {{#if ctrl.pagingSize}}{{ctrl.pagingSize}}{{else}}20{{/if}},
showQuickJumper: true,
showTotal: (total: number, range: IParam[]) => `${range[0]}-${range[1]} of ${total} items`,
pageSizeOptions: ['10','20','50','100'],
......@@ -35,7 +37,7 @@ export const CtrlConfig = {
pagination: false,
{{/if}}
columnsModel: [
{{#each ctrl.pSDEGridColumns as | column |}}
{{#each ctrl.psDEGridColumns as | column |}}
{{#if @last}}
{{>(lookup 'COLUMNMODEL') item=column lastColumn=true}}
{{else}}
......
......@@ -30,12 +30,9 @@ const props = withDefaults(defineProps<Props>(), {
interface CtrlEmit {
(name: "ctrlEvent", value: IActionParam): void;
}
const emit = defineEmits<CtrlEmit>();
// 安装功能模块,提供状态和能力方法
const { state, handleEditorEvent } = new GridControl(CtrlConfig).moduleInstall(props);
// 表格滚动条配置
const gridScrollOption = computed(() => {
return {
......@@ -57,12 +54,10 @@ const rowSelectionOption = computed(() => {
},
};
});
// 处理拖动列
const handleResizeColumn = (width: number, column: IParam) => {
column.width = width;
}
// 处理表格变化(分页,过滤,排序)
const handleChange = (pagination: IParam, filters: IParam, sorter: IParam, data: IParam) => {
const { current, pageSize } = pagination;
......@@ -106,7 +101,7 @@ for (let i = 0; i < 100; i++) {
</div>
</template>
<template #bodyCell="{ column, text, record }">
{{#each ctrl.pSDEGridColumns as | column |}}
{{#each ctrl.psDEGridColumns as | column |}}
{{>(lookup 'COLUMN') item=column ctrl=ctrl}}
{{/each}}
</template>
......@@ -114,7 +109,7 @@ for (let i = 0; i < 100; i++) {
<template #summary>
<a-table-summary-row>
<a-table-summary-cell>数据聚合</a-table-summary-cell>
{{#each ctrl.pSDEGridColumns as | column |}}
{{#each ctrl.psDEGridColumns as | column |}}
{{>(lookup 'SUMMARYCOLUMN') item=column ctrl=ctrl}}
{{/each}}
</a-table-summary-row>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册