diff --git a/packages/panel-design/src/service/pspanel-item-logic/pspanel-item-logic.service.ts b/packages/panel-design/src/service/pspanel-item-logic/pspanel-item-logic.service.ts index 282b20a7c7e076ab0d9cc198a211b4465946b0ca..695a29fe46b5e1b6ca82a321f4840ec3d6992263 100644 --- a/packages/panel-design/src/service/pspanel-item-logic/pspanel-item-logic.service.ts +++ b/packages/panel-design/src/service/pspanel-item-logic/pspanel-item-logic.service.ts @@ -1,6 +1,7 @@ import { DEService, IDataEntity } from '@ibiz-template/runtime'; import { IHttpResponse } from '@ibiz-template/core'; import { IAppDataEntity, ICodeItem } from '@ibiz/model-core'; +import { generateOrderValue } from 'qx-util'; import { PSPanelItemLogic } from '../../entity'; const ValueOPs: IData = { @@ -65,9 +66,41 @@ export class PSPanelItemLogicService extends DEService { this.beforeUpdate(context, params); } } + if (params && id === 'create') { + await this.fillDefault(context, params); + } return super.exec(id, context, params, params2, header); } + /** + * 填充默认值 + * + * @author zhanghengfeng + * @date 2024-12-27 21:12:12 + * @protected + * @param {IContext} context + * @param {(IData | IData[])} params + * @return {*} {Promise} + */ + protected async fillDefault( + context: IContext, + params: IData | IData[], + ): Promise { + const res = await this.fetchDefault(context); + if (res && res.ok && Array.isArray(res.data)) { + const orderValue = Math.max( + ...res.data.map(item => item.ordervalue || 0), + 0, + ); + const items = Array.isArray(params) ? params : [params]; + items.forEach((item, i) => { + if (item.ordervalue == null) { + item.ordervalue = orderValue + generateOrderValue(i); + } + }); + } + } + /** * 更新之前 * diff --git a/packages/valuerule-design/src/panel-items/value-rule-design-content/value-rule-design-content.controller.ts b/packages/valuerule-design/src/panel-items/value-rule-design-content/value-rule-design-content.controller.ts index 5d5e57d3983aa7ac95d23f96f5174fdae447a893..79dd7818c792621844d5a50f16e83525c3cc6f1f 100644 --- a/packages/valuerule-design/src/panel-items/value-rule-design-content/value-rule-design-content.controller.ts +++ b/packages/valuerule-design/src/panel-items/value-rule-design-content/value-rule-design-content.controller.ts @@ -302,7 +302,12 @@ export class ValueRuleDesignContentController extends PanelItemController { connecting: { allowBlank: false, allowEdge: false, - router: 'manhattan', + router: { + name: 'manhattan', + args: { + snapToGrid: false, + }, + }, }, interacting: false, });