3.5.7 前端组件自定义(初级篇)

Oinone社区 作者:梁, 丁原创文章,如若转载,请注明出处:https://doc.oinone.top/other/12756.html

访问Oinone官网:https://www.oinone.top获取数式Oinone低代码应用平台体验

(0)
梁, 丁的头像梁, 丁数式管理员
上一篇 2024年5月23日 am10:23
下一篇 2024年5月23日

相关推荐

  • 模版名称如何翻译

    导出翻译项: mutation { excelExportTaskMutation { createExportTask( data: { workbookDefinition: { model: "file.ExcelWorkbookDefinition" name: "excelLocationTemplate" } } ) { name } } } { "path": "/file", "lang": "en-US" } 导入翻译项: mutation { excelImportTaskMutation { createImportTask( data: { workbookDefinition: { model: "file.ExcelWorkbookDefinition" name: "excelLocationTemplate" } file: { url: "https://minio.oinone.top/pamirs/upload/zbh/test/2024/06/03/导出国际化配置模板_1717390304285_1717391684633.xlsx" } } ) { name } } } PS:导入自行修改url进行导入

    2025年2月7日
    38900
  • 新人引导文档

    类型 文档链接 入门参考必看 7天入门到精通 Oinone 初级学习路径 Oinone 初级学习路径 平台部署启动 无代码docker启动说明 低代码启动说明 前端环境和启动前端工程 无代码设计器启动方式 后端无代码设计器Jar包启动方法 平台部署及依赖说明 Oinone平台部署及依赖说明(v5.0) 问题排查方法 问题排查工具使用手册 前后端研发帮助文档 前端文档 后端文档 项目开发实践要点 【前端】项目开发前端知识要点地图 【后端】项目开发后端知识要点地图 版本升级说明 版本更新日志 工具包 【附件一】下载说明 许可证使用说明 pamirs-license 许可证使用常见问题 更多文档新人引导建议,可以下方评论

    2024年7月15日
    1.2K00
  • 工作流审批退回,撤销API

    审批退回API mutation { workflowUserTaskMutation { approveRejust( workflowUserTask: {id: 701530152718787758, userTaskViewName: "工作流任务待办xml_workflow", userTaskReadonlyViewName: "工作流任务待办detail_workflow", source: "超级管理员", statusDisplayName: "待处理", avatarUrl: "https://pamirs.oss-cn-hangzhou.aliyuncs.com/oinone/img/workflow/default.png", name: "测试流程", instanceId: 701530152718787737, taskId: 701530152718787756, definitionId: 701530152718787698, definitionVersion: 34, canAddSignApproval: false, content: null, nodeId: "APPROVAL0000000000014502", userType: USER_TYPE_USER, userId: 10001, model: "top.Teacher", nodeContext: "{\"id\":\"700755598316612629\",\"teacherName\":\"1234312\",\"readStatus\":\"NO_READ\",\"pamirsUser\":[]}", taskType: APPROVE, viewId: 701530152718787696, viewReadonlyId: 701530152718787697, taskCreateDate: "2025-01-22 14:31:12", flowCreateDate: "2025-01-22 14:30:50", allowTransfer: false, allowAddSign: false, allowFallback: true, allowStaging: true, allowAgree: true, allowReject: true, readConfirm: false, mustReason: false, isUrge: false, status: ACTIVE, filterAddSign: "id>=0 ", filterTransfer: "id>=0 ", hasFallback: true, workflowBackNode: {id: 701530152718787702, fallBackNodeName: "填写"}, filterFallBackNodeIds: "'WRITE0000000000014501'"} ) { id addSignUserId transferUserId workflowBackNodeId enableCustomView isCopy isRecall isClose isFallBack operateType workflowModule { id logo bitOptions attributes displayName sys name systemSource module sign abbr hash dsKey summary description state boot application latestVersion platformVersion publishedVersion publishCount defaultCategory category moduleDependencies moduleExclusions moduleUpstreams excludeHooks priority website author demo web license toBuy maintainer contributors url selfBuilt metaSource clientTypes show defaultHomePageModel homePageModel defaultHomePageName homePageName defaultLogo createDate writeDate createUid writeUid } module userTaskViewName userTaskReadonlyViewName source fromDepartment fromCorpName fromCorpLogo fromCorpId workflowVersion statusDisplayName helpDisplayName avatarUrl name title workflowUserInstanceId instanceId instance { id name title bizType source fromDepartment…

    2025年1月22日
    70000
  • 自定义字段样式

    在日常开发中,我们经常会遇到需要根据业务规则动态展示字段样式的场景,比如表格、表单或详情中的某些字段需要改变文字颜色。本文将通过一个具体的案例,带大家实现这一功能。 以下以 自定义表格字段文字颜色 为例。 实现步骤 1. 在界面设计器中添加组件 通过界面设计器,添加一个组件 2. 创建元件 以表格的「金额字段」为例,创建对应的元件(可根据自己的业务场景调整)。 3. 配置元件属性 进入元件设计页面,从组件库中拖入「单行文本」到设计区域。在右侧属性面板中填写相关配置并保存 4. 保存元件 完成配置后,保存元件。 5. 发布元件 将元件发布,供页面设计使用。 6. 切换表格字段 进入页面设计器,将表格中的字段切换为刚刚创建的元件。 7. 配置字段颜色 在右侧属性面板中,配置字段的文字颜色: 固定颜色:直接输入颜色值(如 red)。 动态颜色:输入表达式,根据业务逻辑动态展示颜色。例如:当前行的名称等于 1 时显示红色,否则为蓝色。 示例表达式: activeRecord.name === '1' ? 'red' : 'blue' 8: 在代码中,自定义对应的表格字段 import { SPI, BaseFieldWidget, ModelFieldType, ViewType, TableCurrencyFieldWidget, Widget, RowContext, numberZeroFill, numberAddThousandth, Expression, ExpressionRunParam } from '@kunlun/dependencies'; import { toString } from 'lodash-es'; import { createVNode, VNode } from 'vue'; @SPI.ClassFactory( BaseFieldWidget.Token({ viewType: [ViewType.Table], ttype: [ModelFieldType.Currency], widget: 'TableCurrencyColor' }) ) export class TableCustomCurrencyFieldWidget extends TableCurrencyFieldWidget { computedFieldColor(context: RowContext) { const { fieldColor = ' ' } = this.getDsl(); if (!fieldColor) { return null; } // 如果当前颜色是表达式,则需要计算 if (Expression.hasKeywords(fieldColor)) { const params: ExpressionRunParam = { activeRecords: [context.data], rootRecord: {}, openerRecord: {}, scene: '' }; return Expression.run(params, fieldColor, fieldColor)!; } return fieldColor; } @Widget.Method() public renderDefaultSlot(context: RowContext): VNode[] | string { let value = numberZeroFill(toString(super.compute(context)), this.getPrecision(context)); if (this.getShowThousandth(context)) { value = numberAddThousandth(value); } return [ createVNode( 'div', { style: { color: this.computedFieldColor(context) } }, value ) ]; } } 9: 页面效果图

    2025年1月9日
    4.6K00
  • 前端 快速查询并替换默认组件

    可以借助vue的调试工具快速找到对应的组件,请参考这篇文章 使用vue调试工具快速找到对应的组件 Mask默认组件 重写Mask组件 重写AppSwitcherWidget import Com from './com.vue' /** * SPI注册条件保持根 AppSwitcherWidget 一致,即可覆盖 */ @SPI.ClassFactory( MaskWidget.Token({ widget: 'app-switcher' }) ) export class CustomAppSwitcherWidget extends AppSwitcherWidget { /** * 如果需要重写vue组件,那么可以通过重写initialize方法来实现,如果是修改数据或者逻辑,那么可以删除这个函数 */ public initialize(props: any) { super.initialize(props); this.setComponent(Com) return this } } 重写 MenuWidget import Com from './com.vue' /** * SPI注册条件保持根 MenuWidget 一致,即可覆盖 */ @SPI.ClassFactory(MaskWidget.Token({ widget: 'nav-menu' })) export class CustomMenuWidget extends MenuWidget { /** * 如果需要重写vue组件,那么可以通过重写initialize方法来实现,如果是修改数据或者逻辑,那么可以删除这个函数 */ public initialize(props: any) { super.initialize(props); this.setComponent(Com) return this } } 重写 NotificationWidget import Com from './com.vue' /** * SPI注册条件保持根 NotificationWidget 一致,即可覆盖 */ @SPI.ClassFactory(MaskWidget.Token({ widget: 'notification' })) export class CustomNotificationWidget extends NotificationWidget { /** * 如果需要重写vue组件,那么可以通过重写initialize方法来实现,如果是修改数据或者逻辑,那么可以删除这个函数 */ public initialize(props: any) { super.initialize(props); this.setComponent(Com) return this } } 重写 LanguageWidget import Com from './com.vue' /** * SPI注册条件保持根 LanguageWidget 一致,即可覆盖 */ @SPI.ClassFactory(MaskWidget.Token({ widget: 'language' })) export class CustomLanguageWidget extends LanguageWidget { /** * 如果需要重写vue组件,那么可以通过重写initialize方法来实现,如果是修改数据或者逻辑,那么可以删除这个函数 */ public initialize(props: any) { super.initialize(props); this.setComponent(Com) return this } } 重写 UserWidget import Com from './com.vue' /** * SPI注册条件保持根 UserWidget 一致,即可覆盖 */ @SPI.ClassFactory(MaskWidget.Token({ widget: 'user' })) export class CustomUserWidget extends UserWidget { /** * 如果需要重写vue组件,那么可以通过重写initialize方法来实现,如果是修改数据或者逻辑,那么可以删除这个函数 */ public initialize(props: any) { super.initialize(props);…

    2025年8月14日
    39300

Leave a Reply

登录后才能评论