low-code-mcp-stdio
Advanced tools
| "use strict"; | ||
| var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
| function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
| return new (P || (P = Promise))(function (resolve, reject) { | ||
| function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
| function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
| function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
| step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
| }); | ||
| }; | ||
| var __importDefault = (this && this.__importDefault) || function (mod) { | ||
| return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.registerGenerateASTDescTool = void 0; | ||
| const ast_1 = require("../utils/ast"); | ||
| const zod_1 = __importDefault(require("zod")); | ||
| const registerGenerateASTDescTool = (server) => { | ||
| server.registerTool("generate-migration-report", { | ||
| description: "生成迁移报告所需的任务步骤列表", | ||
| inputSchema: { | ||
| filePath: zod_1.default.string().describe("本地源文件的绝对路径"), | ||
| targetPath: zod_1.default.string().describe("本地源文件所在的目录绝对地址"), | ||
| lowcodeJsonPath: zod_1.default.string().describe("低代码页面的schema文件的绝对路径"), | ||
| } | ||
| }, (input) => __awaiter(void 0, void 0, void 0, function* () { | ||
| const { filePath, lowcodeJsonPath, targetPath } = input; | ||
| // 生成AST描述文件,调用本地脚本 | ||
| const astDescPath = yield (0, ast_1.generateASTDesc)(filePath, targetPath); | ||
| return { | ||
| content: [{ | ||
| type: "text", text: ` | ||
| 执行以下任务: | ||
| 1.根据${astDescPath}这个描述文件,结合${filePath}原文件,帮我生成一个ast.json文件写入到ast.json文件中。 | ||
| 这个文件尽可能详细覆盖整个页面,注意请求路径等可能会存在公共前缀。显示分析过程。 | ||
| [1.交互流程,例如点击查询,点击重置,点击非表格中的操作按钮等后续的整个页面渲染的交互流程] | ||
| [2.点击可点击dom的操作事件,分为是否直接调用接口,是否打开弹窗,打开弹窗记录详细弹窗中的后续步骤以及弹窗中的内容,是否跳转链接,是否直接修改数据] | ||
| [3.template模版中条件分支,v-if、v-else相关的处理逻辑] | ||
| [4.js函数中条件分支,if、三目运算、swtich] | ||
| [5.函数方法调用,函数相关可能有打开弹窗,打开弹窗功能需要分析modal中的具体内容跟逻辑,modal弹窗中的字段需要列出,注意modal弹窗中的字段对应显示隐藏条件,比如hide: xxx或其他显示或者权限控制条件,函数也可能调用接口,需要列出具体函数接受参数以及调用的接口参数,注意不要把方法名称当成请求的url,接口url确保准确,可查看原代码实现] | ||
| [6.表格渲染数据,非直接展示的请记录template模版如何处理,例如显隐条件以及dom或者标签颜色] | ||
| [7.表格最后一项如果为操作项需要单独列出,并记录相关按钮的实现功能,如果是打开弹窗需要分析弹窗中的内容跟后续动作,modal弹窗中的字段需要列出,注意modal弹窗中的字段对应显示条件,比如hide: xxx或其他显隐条件。如果是跳转需记录跳转url,操作按钮需详记录相关动作] | ||
| [8.权限点,页面中按钮的权限点,例如v-if='xxx',没有请忽略] | ||
| [9.所有相关枚举,包括静态枚举跟接口获取的枚举,接口获取枚举注意原文件中接口名可能有公共前缀,请注意不要把方法名字当成url,如果没有枚举可不处理] | ||
| 2.${targetPath}/ast.json 是刚刚生成的页面描述文件,${lowcodeJsonPath}对应低代码页面的schema。 | ||
| 请对比两个文件,生成一个详细的低代码功能迁移完整度的报告(输出到${targetPath}/report.html,代码格式要保留,使用pre标签;样式UI要好看,菜单导航一定要有锚点绝对定位悬浮在左上角,表格要美观,不要有错位),每个对比维度都以表格形式展示。 | ||
| 注意,所有处理number类型相关的考虑保存到小数点后几位,请求相关注意请求路径等可能会存在公共前缀。 | ||
| [1.查询功能,是否自动查询,查询配置的options可能会根据不同条件返回不同options,例如海外国内返回的options可能不一致。每个参数的相关信息组件类型input、select或其他。组件的placeholder,select的枚举配置,枚举配置注意不要把方法名称当成枚举接口的url请准确给出枚举接口url可检索原代码。datepicker精确格式YYYY-MM-DD HH:mm:ss还是YYYY-MM-DD,options中如果各项有联动关系给指出,查询时的组件默认值,查询每一页分页数] | ||
| [2.重置功能] | ||
| [3.操作功能,页面中非表格中的按钮,例如点击按钮打开弹窗的新增功能或上传功能、路由跳转。检查操作功能否具有权限控制以及显隐条件,打开弹窗功能需要分析modal中的具体内容跟逻辑,modal弹窗中的字段需要列出,注意modal弹窗中的字段对应显示隐藏条件,比如hide: xxx,以及各字段之间是否具有相关联动以及字段是否需要校验] | ||
| [4.导出功能,页面中非表格中的按钮,例如点击按钮导出数据。如果导出有参数指出,导出场景的参数可能为选中table表格中的id或其他字段,也可能为查询功能的参数也可能为其他,请具体分析] | ||
| [5.table表格的对应展示字段,table的options可能会根据不同条件返回不同options,例如海外国内返回的options可能不一致。每一项如果不是直接展示需要具体列出原代码的处理逻辑,例如template具体如何实现的,template模版处理的逻辑dom或标签以及对应的style,涉及到低代码自定义渲染的请深度分析并展示代码。如果是switch开关的场景点击后判断是否重新调用查询,非直接展示项需要考虑是否可操作,是否具有权限控制、显示隐藏条件比如hide: xxx] | ||
| [6.table表格中最后一列如果为操作项,操作项中的功能按钮单独列出,并按照功能维度检查是否具有显示隐藏的条件以及权限控制,每个按钮对应功能需要深度分析,打开弹窗需要分析弹窗中的内容,modal弹窗中的字段需要列出,注意modal弹窗中的字段对应显示隐藏条件,比如hide: xxx,以及各字段之间是否具有相关联动。表格最后一列如果不是操作项请忽略] | ||
| [7.全局枚举以及枚举接口,包括静态枚举跟接口获取的枚举,接口获取枚举注意原文件中接口名可能有公共前缀,请注意不要把方法名字当成url,没有枚举请忽略] | ||
| [8.原代码接口参数以及API需要单独按照功能维度列出 例如查询功能,重置功能,操作功能,导出功能,获取详情,保存,修改状态以及其他功能,可能具有公共前缀,请注意不要把方法名称当作url] | ||
| [9.权限点单独列出,例如哪些功能点需要具有权限点才可操作,如果没有权限点请忽略]。 | ||
| [11.迁移报告按照原代码中的功能然后跟低代码中的功能对比,如果原代码中没有实现的功能就不用对比了,如果迁移功能不完整需要加上原代码详细实现,可以检索原代码] | ||
| [12.报告结尾列举迁移没有完整的功能,并附上对应的原代码详细实现,可以检索原代码] | ||
| 3.删除${targetPath}/ast.json文件,删除${astDescPath}文件以及其他的临时文件 | ||
| ` | ||
| }], | ||
| }; | ||
| })); | ||
| }; | ||
| exports.registerGenerateASTDescTool = registerGenerateASTDescTool; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.formItemOptimizationPrompt = void 0; | ||
| exports.formItemOptimizationPrompt = ` | ||
| 【**表单项优化**】 | ||
| 低代码的组件是二次封装antd-vue4,组件API跟源码版本不一致可能存在差异,比如: | ||
| - textArea组件的 autoSize 在低版本中是对象,高版本中是布尔值:"autoSize": false,"minRows": 2,"maxRows": 6 | ||
| - button组件的danger在低版本中是跟type融合在一起,高版本中是独立的属性:"danger": true | ||
| 【**表单项联动优化**】 | ||
| - 如果是在 $effect 做联动,form实例的获取为 $form, 当前表单实例为 $self | ||
| - 比如:$effect(() => { $form.setFieldState('selectResult', (state) => { state.visible = $self.value === 'select'; }); }, [$self.value]) | ||
| 【**表单中的按钮优化**】 | ||
| - FormilyFormNew 中的 props.showBtnSlot 是操作按钮(重置、查询),默认都要放进去,不要忽略 | ||
| - 除非是明确定义了table的局部search功能,否则一律使用 FormilyFormNew 放在最外层做表单查询 | ||
| `; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.getEnumPrompt = void 0; | ||
| exports.getEnumPrompt = ` | ||
| 枚举 URL 转换规则: | ||
| 核心任务:将原代码中的 Enum.query() 接口调用转换为完整的 URL 路径 | ||
| 1. URL 转换模式识别 | ||
| 模式1:Resource.method 形式 | ||
| 示例: | ||
| import FrontSearchSelect from 'cash-loan-admin-web/common/resource/api-config/front-search-select'; | ||
| Enum.query(FrontSearchSelect.checkItemList, {...}) | ||
| 转换步骤: | ||
| - 定位 FrontSearchSelect 资源配置文件 | ||
| - 查找 api.urlPrefix(如:'/loan/admin/operation/cashloan/precheck') | ||
| - 查找 api.checkItemList.url(如:'checkItemList') | ||
| - 拼接完整 URL = urlPrefix + '/' + url | ||
| - 结果:'/loan/admin/operation/cashloan/precheck/checkItemList' | ||
| 模式2:函数调用形式 | ||
| 示例: | ||
| import ManufacturerApi from 'src/common/resource/manufacturer'; | ||
| Enum.query((params) => ManufacturerApi.getMatchList(params), {...}) | ||
| 转换步骤: | ||
| - ⚠️ 不要将 params 当作方法名 | ||
| - 识别函数内部的实际调用:ManufacturerApi.getMatchList | ||
| - 定位 ManufacturerApi 资源配置文件 | ||
| - 查找 getMatchList 方法定义(如:customGet('provider/list')) | ||
| - 提取完整 URL 路径 | ||
| - 结果:'/risk/admin/platform/provider/list' | ||
| 2. 转换示例 | ||
| 示例1: | ||
| 原代码: | ||
| import FrontSearchSelect from 'cash-loan-admin-web/common/resource/api-config/front-search-select'; | ||
| Enum.query(FrontSearchSelect.checkItemList, {...}) | ||
| 配置文件: | ||
| export const api = { | ||
| urlPrefix: '/loan/admin/operation/cashloan/precheck', | ||
| checkItemList: { | ||
| url: 'checkItemList', | ||
| method: 'get' | ||
| } | ||
| } | ||
| 转换为:url: '/loan/admin/operation/cashloan/precheck/checkItemList' | ||
| 示例2: | ||
| 原代码: | ||
| import ManufacturerApi from 'src/common/resource/manufacturer'; | ||
| Enum.query((params) => ManufacturerApi.getMatchList(params), {...}) | ||
| 配置文件: | ||
| getManufacturerList: customGet('provider/list') | ||
| 转换为:url: '/risk/admin/platform/provider/list' | ||
| 示例3: | ||
| 原代码: | ||
| export const BooleanType = { | ||
| TRUE: 'TRUE', | ||
| FALSE: 'FALSE' | ||
| }; | ||
| export const LotteryType = { | ||
| PRIZE_WHEEL: 'xxx', | ||
| CLAW_CRANE: 'xxxx' | ||
| }; | ||
| 转换为:静态枚举,不需要 URL(保持 value 大小写不变:'TRUE' 不能变成 'true') | ||
| 3. 注意事项 | ||
| ❌ 错误:将函数参数名当作方法名 | ||
| (params) => Api.method(params) ← params 不是方法名 | ||
| ✅ 正确:识别实际的 API 调用 | ||
| 函数内调用的是 Api.method | ||
| ❌ 错误:URL 拼接错误 | ||
| '/prefix' + 'path' = '/prefixpath' ❌ | ||
| ✅ 正确:规范拼接 | ||
| '/prefix' + '/' + 'path' = '/prefix/path' ✅ | ||
| `; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.modalAddPrompt = void 0; | ||
| exports.modalAddPrompt = ` | ||
| 弹窗表单新增优化检查: | ||
| 核心规则: | ||
| 1. 表单定义识别 | ||
| - 关键特征:原代码使用 defineForm 定义表单结构 | ||
| - fieldDefs:定义表单字段数组,每个字段包含 name、required、props、hide 等配置 | ||
| - 处理方式: | ||
| * 将每个 fieldDef 转换为对应的低代码表单项组件 | ||
| * 提取字段的 name 属性作为表单项的 name | ||
| * 提取 required 属性设置表单项的必填规则 | ||
| * 提取 enumType 属性设置下拉框的枚举选项 | ||
| * 提取 hide 函数转换为 reactionsSetter 联动配置 | ||
| 2. 表单组件映射 | ||
| 存量组件 -> 低代码组件: | ||
| 3. 提交数据转换(requestDataFunc) | ||
| 步骤: | ||
| - 分析 onConfirm 方法中的数据处理逻辑 | ||
| - 识别数据转换模式: | ||
| - 在 requestDataFunc 中实现相同的转换逻辑 | ||
| - 返回符合后端接口要求的数据结构 | ||
| 4. 字段联动处理(reactionsSetter) | ||
| - 识别 hide 函数:返回true 或 false | ||
| - 转换为 reactionsSetter 配置: | ||
| reactionsSetter: { | ||
| dependencies: [{ | ||
| property: "value", | ||
| type: "any", | ||
| source: "xxx", // 依赖字段 | ||
| name: "xxx" | ||
| }], | ||
| fulfill: { | ||
| run: "", | ||
| state: {} | ||
| } | ||
| } | ||
| 5. 特殊数据结构处理 | ||
| - FormilyFormList(表单列表): | ||
| * 存量代码中的 selectResult 是数组:[{value: 'x', enumValue: 'y'}] | ||
| * 需要在 requestDataFunc 中转换为对象:{y: 'x'} | ||
| * 注意处理数组为空的情况 | ||
| - 枚举映射对象: | ||
| * 存量代码:opt.reduce((acc, key) => ({...acc, [key]: OptEnum[key]}), {}) | ||
| * 将枚举 key 转换为 key-value 对象 | ||
| * 确保枚举值存在性检查 | ||
| - 派生字段计算: | ||
| * 根据其他字段值计算新字段 | ||
| 6. 真实业务场景参考 | ||
| 存量代码模式: | ||
| export default defineForm({ | ||
| fieldDefs: [ | ||
| merge(Fields.name, { required }), | ||
| merge(Fields.opt, { | ||
| props: { mode: 'multiple' }, | ||
| required, | ||
| enumType: OptEnum | ||
| }), | ||
| merge(Fields.optStyle, { required }), | ||
| merge(Fields.selectResult, { | ||
| required, | ||
| hide: ({record: {optStyle}}) => optStyle !== 'select' | ||
| }) | ||
| ] | ||
| }); | ||
| async onConfirm({values}) { | ||
| const {name, opt, optStyle, selectResult} = values; | ||
| const optObj = opt?.reduce((acc, key) => ({...acc, [key]: OptEnum[key]}), {}); | ||
| const selectResultObj = selectResult?.reduce((acc, item) => ({...acc, [item.enumValue]: item.value}), {}); | ||
| const multipleChoice = opt.some(item => ['IN', 'CONTAIN'].includes(item)) ? 1 : 0; | ||
| await CallbackResource.addFeature({ | ||
| name, | ||
| opt: optObj, | ||
| optStyle, | ||
| selectResult: selectResultObj, | ||
| multipleChoice, | ||
| cate: 'rickFeature' | ||
| }); | ||
| } | ||
| 低代码转换后的配置: | ||
| { | ||
| componentName: "FormilyFormModalNew", | ||
| props: { | ||
| modalTitle: "创建风险特征", | ||
| requestConfig: { | ||
| url: "/api/callback/feature/add", | ||
| method: "POST", | ||
| requestDataFunc: \`async function(data, formInstance, util) { | ||
| const {name, opt, optStyle, selectResult, rickType} = data || {}; | ||
| // 枚举映射 - 将 opt 数组转换为对象 | ||
| const OptEnumMap = { | ||
| 'IN': '属于', | ||
| 'CONTAIN': '包含', | ||
| 'GT': '大于', | ||
| 'EQ': '等于', | ||
| 'LT': '小于', | ||
| 'RANGE': '闭区间' | ||
| }; | ||
| const optObj = opt?.reduce((acc, key) => ({...acc, [key]: OptEnumMap[key]}), {}); | ||
| // 处理 selectResult - FormilyFormList 数据格式 | ||
| let selectResultObj = {}; | ||
| if (selectResult && Array.isArray(selectResult)) { | ||
| selectResultObj = selectResult.reduce((acc, item) => { | ||
| return {...acc, [item.enumValue1]: item.value1}; | ||
| }, {}); | ||
| } | ||
| // 计算派生字段 | ||
| const multipleChoice = opt?.some(item => ['IN', 'CONTAIN'].includes(item)) ? 1 : 0; | ||
| return { | ||
| name, | ||
| opt: optObj, | ||
| optStyle, | ||
| selectResult: selectResultObj, | ||
| rickType, | ||
| multipleChoice, | ||
| cate: 'rickFeature' | ||
| }; | ||
| }\` | ||
| }, | ||
| openSlot: { | ||
| type: "JSSlot", | ||
| value: [ | ||
| { | ||
| componentName: "FormilyFormNew", | ||
| children: [ | ||
| { | ||
| componentName: "FormilyInput", | ||
| props: { | ||
| label: "名称", | ||
| name: "name", | ||
| required: true | ||
| } | ||
| }, | ||
| { | ||
| componentName: "FormSelect", | ||
| props: { | ||
| label: "运算规则", | ||
| name: "opt", | ||
| required: true, | ||
| mode: "multiple", // 多选模式 | ||
| enumName: "optEnum" | ||
| } | ||
| }, | ||
| { | ||
| componentName: "FormRadio", | ||
| props: { | ||
| label: "操作方式", | ||
| name: "optStyle", | ||
| required: true, | ||
| enumName: "optStyleEnum", | ||
| reactionsSetter: { | ||
| dependencies: [{property: "value", type: "any"}], | ||
| fulfill: { | ||
| run: "$effect(() => { $form.setFieldState('selectResult', (state) => { state.visible = $self.value === 'select'; }); }, [$self.value])" | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| componentName: "FormilyFormList", | ||
| props: { | ||
| label: "选择结果", | ||
| name: "selectResult", | ||
| // 初始隐藏,由 optStyle 控制显示 | ||
| }, | ||
| children: [ | ||
| { | ||
| componentName: "FormilyFormNew", | ||
| props: { layout: "inline" }, | ||
| children: [ | ||
| { | ||
| componentName: "FormilyInput", | ||
| props: { | ||
| label: "值", | ||
| name: "value1", | ||
| required: true | ||
| } | ||
| }, | ||
| { | ||
| componentName: "FormilyInput", | ||
| props: { | ||
| label: "枚举值", | ||
| name: "enumValue1", | ||
| required: true | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| 7. 子表单类型处理(FormilyChildFormList) | ||
| 核心特征识别: | ||
| - 存量代码中字段配置包含 formOptions.fieldDefs(嵌套表单定义) | ||
| - 通常配合 itemProps 和 props.ref 使用 | ||
| 真实业务场景参考存量代码模式: | ||
| export default templateIdMap => ({ | ||
| fieldDefs: [ | ||
| required(merge(Fields.templateIds, { | ||
| itemProps: {class: 'template-group'}, | ||
| formOptions: { | ||
| layout: 'horizontal', | ||
| fieldDefs: [ | ||
| { | ||
| field: 'templateId', | ||
| enumType: templateIdMap, | ||
| required: true, | ||
| autoSearchMinLen: 100 | ||
| } | ||
| ] | ||
| }, | ||
| props: {ref: 'childForm'} | ||
| })), | ||
| Fields.channelPrefixList, | ||
| Fields.detail | ||
| ] | ||
| }); | ||
| async onConfirm({record}) { | ||
| const {channelPrefixList, templateIds, detail, ...cond} = record; | ||
| const config = { | ||
| registerConfig: { | ||
| channelPrefixList, | ||
| // 关键:子表单数组转换为简单数组 | ||
| templateIds: templateIds.map(({templateId}) => templateId) | ||
| } | ||
| }; | ||
| cond.config = JSON.stringify(config); | ||
| cond.detail = JSON.stringify(detail || []); | ||
| await save(cond); | ||
| } | ||
| 低代码转换规则: | ||
| 1. 组件嵌套结构: | ||
| - 具有子表单 使用 FormilyFormList | ||
| 2. requestDataFunc 处理: | ||
| - 注意 如果有子表单 从 FormilyFormList对应的 name 取值 为数组 | ||
| 完整示例: | ||
| { | ||
| componentName: "FormilyFormModalNew", | ||
| props: { | ||
| modalTitle: "新建注册活动", | ||
| requestConfig: { | ||
| url: "/loan/admin/operation/loan/campaign/createCampaign", | ||
| method: "POST", | ||
| requestDataFunc: \`async function(data, formInstance, util, requestConfig) { | ||
| const values = await formInstance.getValues(); | ||
| const config = { | ||
| registerConfig: { | ||
| // 多行文本处理 | ||
| channelPrefixList: values.channelPrefixList | ||
| ? values.channelPrefixList.split('\\n').filter(Boolean) | ||
| : [], | ||
| const templateIdsdata = formList || [] | ||
| templateIds: (templateIdsdata || []) | ||
| .map(item => String(item.templateId)) | ||
| } | ||
| }; | ||
| return { | ||
| sdkType: values.sdkType, | ||
| name: values.name, | ||
| title: values.title, | ||
| timeStarted: values.timeStarted, | ||
| timeEnded: values.timeEnded, | ||
| // 序列化复杂对象 | ||
| config: JSON.stringify(config), | ||
| detail: JSON.stringify(values.detail | ||
| ? values.detail.split('\\n').filter(Boolean) | ||
| : []), | ||
| type: 'REGISTER' | ||
| }; | ||
| }\` | ||
| }, | ||
| openSlot: { | ||
| type: "JSSlot", | ||
| value: [ | ||
| { | ||
| componentName: "FormilyFormNew", | ||
| children: [ | ||
| // 普通字段... | ||
| { | ||
| componentName: "FormilyInput", | ||
| props: { | ||
| label: "活动名称", | ||
| name: "name", | ||
| required: true | ||
| } | ||
| }, | ||
| // 子表单字段 | ||
| { | ||
| "componentName": "FormilyFormList", | ||
| "id": "node_ocmheowr3pb1", | ||
| "props": { | ||
| "label": "发券种类", | ||
| "name": "formList", | ||
| "orderAdd": true, | ||
| "addText": "添加", | ||
| "showLabel": true, | ||
| "required": true, | ||
| "pattern": "", | ||
| "validator": "", | ||
| "width": "" | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "", | ||
| "children": [ | ||
| { | ||
| "componentName": "FormilyFormNew", | ||
| "id": "node_ocmheowr3pb2", | ||
| "props": { | ||
| "labelCol": 3, | ||
| "wrapperCol": 4, | ||
| "layout": "inline", | ||
| "width": "100%", | ||
| "size": "middle", | ||
| "initFetch": false, | ||
| "colon": false, | ||
| "clearLabelSpace": false, | ||
| "emitEventName": "" | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "", | ||
| "children": [ | ||
| { | ||
| "componentName": "FormSelect", | ||
| "id": "node_ocmheowr3pb6", | ||
| "props": { | ||
| "showLabel": false, | ||
| "label": "模板ID", | ||
| "required": true, | ||
| "name": "templateId", | ||
| "enumName": "TemplateEnum", | ||
| "showSearch": true, | ||
| "mode": "combobox", | ||
| "pattern": "", | ||
| "validator": "", | ||
| "width": "", | ||
| "openTooltip": false, | ||
| "autoClearSearchValue": true, | ||
| "virtual": false, | ||
| "selectAll": false | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| }, | ||
| // 多行文本字段 | ||
| { | ||
| componentName: "FormTextarea", | ||
| props: { | ||
| label: "渠道号", | ||
| name: "channelPrefixList", | ||
| autoSize: true, | ||
| minRows: 4, | ||
| placeholder: "一行一条渠道号(前缀匹配)" | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| 关键注意点: | ||
| - 子表单数据路径:FormilyFormList 对应的name | ||
| - 表单中的Select对应的枚举需要解析正确API | ||
| - 注意传递进来的props 例如 this.$modal.open(EditRegisterActivityModal, {registerActivityInfo, templateIdMap}).then(this.onRefresh); templateIdMap可能为枚举。 | ||
| 8. 关键注意事项 | ||
| - FormilyFormList 的数据结构:确保 requestDataFunc 中正确处理数组数据 | ||
| - 枚举映射:需要明确枚举对象的定义,可能需要在 requestDataFunc 中硬编码 | ||
| - 字段联动:使用 reactionsSetter 而不是 hide 函数 | ||
| - 派生字段:在 requestDataFunc 中计算,不在表单字段中定义 | ||
| - 默认值处理:固定值(如 cate: 'rickFeature')直接在 requestDataFunc 返回对象中添加 | ||
| - 数组安全访问:使用可选链操作符 ?. 避免空值报错 | ||
| `; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.permissionPrompt = void 0; | ||
| exports.permissionPrompt = ` | ||
| 权限配置优化检查: | ||
| 核心规则: | ||
| 1. 权限检查模式识别 | ||
| 常见模式: | ||
| a) 直接注入模式: | ||
| - inject: ['isAuthorized', 'PermissionTypes'] | ||
| - v-if="isAuthorized(PermissionTypes.XXX.YYY.ZZZ)" | ||
| - 特征:单个权限点,直接使用 PermissionTypes 对象 | ||
| b) computed 计算属性模式: | ||
| - computed: { hasXxxPermission() { return this.$app.isAuthorized([...]) } } | ||
| - v-if="hasUpdatePermission" | ||
| - 特征:可能包含多个权限点,通过数组传递 | ||
| c) 函数调用模式: | ||
| - const canUpdate = hasAnyAuthorized([Permissions.XXX.YYY, ...]) | ||
| - v-if="canUpdate" | ||
| - 特征:使用 hasAnyAuthorized 或 hasAllAuthorized 函数 | ||
| 2. PermissionTypes 对象构建规则 | ||
| 3. 权限前缀处理 | ||
| a) 前缀: | ||
| b) 动态前缀: | ||
| 4. 多权限码合并规则 | ||
| - 当按钮/操作需要多个权限时,使用逗号分隔 | ||
| - 格式:permissionCodes: "CODE1,CODE2,CODE3" | ||
| - 注意:权限码之间不要有空格(除非原本就有) | ||
| - 示例: | ||
| 单个权限:{ "permissionCodes": "LAUNCHMANAGE.CALLBACKFEATURE.EDIT" } | ||
| 多个权限:{ "permissionCodes": "ADMIN@CASH_LOAN.API_PRECHECK_CONFIG.MODIFY,ADMIN@CASH_LOAN.API.CONFIG.OPERATE" } | ||
| 5. 权限码提取步骤 | ||
| 步骤一:定位权限检查代码 | ||
| - 查找 v-if 中的权限检查表达式 | ||
| - 识别 isAuthorized、hasAnyAuthorized 等函数调用 | ||
| - 追踪 computed 属性中的权限逻辑 | ||
| 步骤二:分析 PermissionTypes 访问路径 | ||
| 步骤三:查找 PermissionTypeArr 定义 | ||
| - 定位权限常量数组的定义 | ||
| - 匹配访问路径对应的原始权限字符串 | ||
| - 确认是否有前缀(动态前缀等) | ||
| 步骤四:处理权限前缀 | ||
| 步骤五:生成最终配置 | ||
| - 单个权限:直接使用原始字符串 | ||
| - 多个权限:用逗号连接所有权限字符串 | ||
| 6. 真实业务场景参考 | ||
| 场景一:单权限按钮(直接注入模式) | ||
| 原代码: | ||
| <a-button | ||
| v-if="isAuthorized(PermissionTypes.LAUNCHMANAGE.CALLBACKFEATURE.EDIT)" | ||
| type="primary" | ||
| icon="plus" | ||
| @click="onCreateRiskCharacter()" | ||
| > | ||
| 新增 | ||
| </a-button> | ||
| inject: ['isAuthorized', 'PermissionTypes'] | ||
| export const PermissionTypeArr = ['LAUNCHMANAGE.CALLBACKFEATURE.EDIT'] | ||
| 低代码配置: | ||
| { | ||
| "permissionCodes": "LAUNCHMANAGE.CALLBACKFEATURE.EDIT" | ||
| } | ||
| 场景二:多权限按钮(computed 模式 + ADMIN@ 前缀) | ||
| 原代码: | ||
| <a-button | ||
| v-if="hasUpdatePermission" | ||
| type="primary" | ||
| @click="addOrEditFrontSearch({})" | ||
| > | ||
| 新增前筛 | ||
| </a-button> | ||
| computed: { | ||
| hasUpdatePermission() { | ||
| return this.$app.isAuthorized([ | ||
| this.$app.PermissionTypes.CASH_LOAN.API_PRECHECK_CONFIG.MODIFY, | ||
| this.$app.PermissionTypes.CASH_LOAN.API.CONFIG.OPERATE | ||
| ]); | ||
| } | ||
| } | ||
| export const PermissionTypeArr = [ | ||
| 'ADMIN@CASH_LOAN.API_PRECHECK_CONFIG.INFO', | ||
| 'ADMIN@CASH_LOAN.API_PRECHECK_CONFIG.MODIFY', | ||
| 'ADMIN@CASH_LOAN.API.CONFIG.OPERATE' | ||
| ] | ||
| 低代码配置: | ||
| { | ||
| "permissionCodes": "ADMIN@CASH_LOAN.API_PRECHECK_CONFIG.MODIFY,ADMIN@CASH_LOAN.API.CONFIG.OPERATE" | ||
| } | ||
| 场景三:多权限按钮(函数调用模式 + 动态前缀) | ||
| 原代码: | ||
| <a-button | ||
| v-if="canUpdate" | ||
| class="inline-flex items-center" | ||
| type="primary" | ||
| ghost | ||
| @click="onCreate" | ||
| /> | ||
| const canUpdate = hasAnyAuthorized([ | ||
| Permissions.PLATFORM.VARIABLE.UPDATE, | ||
| Permissions.PLATFORM.ACCESS.VARIABLE.UPDATE | ||
| ]); | ||
| export const PermissionTypeArr = [ | ||
| 'PLATFORM.VARIABLE.UPDATE', | ||
| 'PLATFORM.ACCESS.VARIABLE.UPDATE' | ||
| ] | ||
| 低代码配置: | ||
| { | ||
| "permissionCodes": "PLATFORM.VARIABLE.UPDATE,PLATFORM.ACCESS.VARIABLE.UPDATE" | ||
| } | ||
| 7. 常见陷阱与注意事项 | ||
| 陷阱一:混淆对象访问路径和权限字符串 | ||
| 陷阱二:忽略权限前缀 | ||
| 陷阱三:多权限分隔符错误 | ||
| - 正确:用逗号分隔,不带空格 | ||
| - 错误:用分号、空格或其他分隔符 | ||
| 陷阱四:遗漏权限点 | ||
| - computed 或函数中可能包含多个权限 | ||
| - 必须全部提取并合并到 permissionCodes 中 | ||
| `; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.tableSearchPromot = void 0; | ||
| exports.tableSearchPromot = ` | ||
| 表格查询参数优化检查: | ||
| 核心规则: | ||
| 1. 解构赋值模式识别 | ||
| - 关键特征:原代码查询函数中出现 const { cond, pagination } = this; | ||
| - cond:代表表单的 options 配置对象,包含用户在表单中输入的所有查询条件 | ||
| - pagination:代表分页配置对象,通常包含 pageSize 和 pageNo | ||
| - 处理方式: | ||
| * 将 cond 视为请求参数的主要来源 | ||
| * 分析 cond 对应的表单项字段(field/name 属性) | ||
| * 提取每个表单项的 key,这些 key 即为请求参数的字段名 | ||
| * 合并 cond 中的字段与默认分页参数 | ||
| 2. 默认参数处理 | ||
| - 必需的分页参数:pageSize(每页显示条数)、pageNo(当前页码) | ||
| - 参数合并:const requestParams = { ...cond, pageSize: pagination.pageSize || 20, pageNo: pagination.pageNo || 1 } | ||
| 3. 表单项字段映射 | ||
| 步骤: | ||
| - 定位表单配置:查找 yqg-simple-form 组件定义 | ||
| - 提取字段信息:props.name 或 props.field 作为请求参数的 key | ||
| - 确定字段类型:componentName(Input、Select、DatePicker 等) | ||
| 4. 特殊字段处理 | ||
| - 时间范围字段(FormilyDateRangePicker):需要拆分为 startTime 和 endTime | ||
| - 枚举字段:检查是否需要转换,验证选中值是否为有效的枚举项 | ||
| - 数组字段(FormilyMultipleSelect):确认后端是否支持数组,可能需要转换为逗号分隔字符串 | ||
| 5. 真实业务场景参考 | ||
| 存量代码模式: | ||
| async onRefresh() { | ||
| const {cond, pagination} = this; | ||
| const {data: {body}} = await CallbackResource.featureList({ | ||
| condition: cond, | ||
| ...pagination | ||
| }); | ||
| } | ||
| 低代码转换后的 requestConditionFunc: | ||
| async function(data, formInstance, util) { | ||
| const {pageNo, pageSize, name} = data; | ||
| // 返回符合后端接口要求的参数结构 | ||
| return { | ||
| condition: {...cond}, // 查询条件对象 | ||
| pageSize, // 每页条数 | ||
| pageNo // 当前页码 | ||
| }; | ||
| } | ||
| `; |
+1
-1
@@ -11,5 +11,5 @@ "use strict"; | ||
| endpoint: "/low-code-mcp", | ||
| sessionTimeout: 300000, // 5分钟 | ||
| sessionTimeout: 1200000, // 20分钟 | ||
| }; | ||
| const getServerUrl = () => `http://localhost:${exports.config.port}`; | ||
| exports.getServerUrl = getServerUrl; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.tableColumnButtonSlotExample = exports.formItemsDetailExample = exports.pageOperationsExample = void 0; | ||
| exports.enumPrompt = exports.tableCellPrompt = exports.tableColumnButtonSlotExample = exports.formItemsDetailExample = exports.pageOperationsExample = void 0; | ||
| exports.pageOperationsExample = ` | ||
| 如果按钮的功能是打开modal,则使用ModalButton组件, | ||
| ## 如果弹窗内容是表单,则内部是FormilyFormNew,具体弹窗内容需要去分析源码的表单项配置 | ||
| 【如果按钮的功能是打开modal,则使用ModalButton组件,】 | ||
| *** 如果弹窗内容是表单,则内部是FormilyFormNew,具体弹窗内容需要去分析源码的表单项配置 | ||
| { | ||
| action: "onCreate" | ||
| action: "onCreate/edit/view" | ||
| condition: "isOverseas" | ||
@@ -24,3 +24,4 @@ name: "新增数据产品" | ||
| } | ||
| } | ||
| }, | ||
| ...其他表单项 | ||
| ] | ||
@@ -31,6 +32,6 @@ } | ||
| ## 如果弹窗内容是表格,则内部是FormilyTable,具体弹窗内容需要去分析源码的表格列配置 | ||
| *** 如果弹窗内容是表格,则内部是FormilyTable,具体弹窗内容需要去分析源码的表格列配置 | ||
| 示例: | ||
| { | ||
| action: "onCreate" | ||
| action: "onCreate/edit/view/history" | ||
| condition: "isOverseas" | ||
@@ -45,3 +46,3 @@ name: "新增数据产品" | ||
| columns: [ | ||
| ...表格列配置(需要去分析源码的表格列配置) | ||
| ] | ||
@@ -54,3 +55,3 @@ } | ||
| ## 如果按钮的功能执行一段逻辑如跳转页面等,则使用Button组件,示例: | ||
| *** 如果按钮的功能执行一段逻辑如跳转页面等,则使用Button组件,示例: | ||
| { | ||
@@ -88,3 +89,3 @@ action: "jump" | ||
| "key": "id", | ||
| "align": "left", | ||
| "align": "center", | ||
| "width": 80, | ||
@@ -131,1 +132,18 @@ "fixed": "", | ||
| `; | ||
| exports.tableCellPrompt = ` | ||
| 分析存量页面中的所有表格列: | ||
| 如果是 hover 提示类型的列,使用 FormText 组件,并设置 hover 提示内容; | ||
| 详细分析每个 column 的配置属性(如 align、width、fixed 等),要求如下: | ||
| - 若原始列中已定义 align(如 "left"、"right"、"center"),必须保留原值,不得覆盖; | ||
| - 若未定义 align,则默认补充为 "center"; | ||
| - 若定义了 width 或 fixed,则原样保留; | ||
| 如果列为按钮类型,则使用 按钮|弹窗按钮 组件; | ||
| 分析完成后注入到上下文中,key 为 pageTableColumns; | ||
| `; | ||
| exports.enumPrompt = ` | ||
| 分析存量页面中的所有按钮权限点,要求: | ||
| - 识别来源:优先从按钮/操作组件的 props(如 permission、v-if、v-else等)检测调用的权限校验方法(如 isAuthorized、hasPermission)和传入的数组/常量(例如 this.$app.PermissionTypes.*)以及页面/组件 import 的权限常量中抽取权限标识; | ||
| - 常量解析:若检测到 PermissionTypes 或类似常量对象(例如 this.$app.PermissionTypes.CASH_LOAN.API_PRECHECK_CONFIG.MODIFY),尝试解析为其实际字符串值;如果无法直接解析,保留常量路径并在输出 evidence 中记录原始表达式和可能的实际值推断; | ||
| - 前缀补全与推断:若权限在运行时需要带前缀推断前缀并拼接 例如( this.$app.isAuthorized([ this.$app.PermissionTypes.CASH_LOAN.API_PRECHECK_CONFIG.MODIFY, this.$app.PermissionTypes.CASH_LOAN.API.CONFIG.OPERATE ]))需要变成 "ADMIN@CASH_LOAN.API_PRECHECK_CONFIG.MODIFY,ADMIN@CASH_LOAN.API.CONFIG.OPERATE" | ||
| 注入key为 pageButtonsPermission | ||
| `; |
+855
-1103
| { | ||
| "componentName": "Page", | ||
| "id": "node_ocm99odwi91", | ||
| "id": "node_ocmh948hp21", | ||
| "props": {}, | ||
| "fileName": "index", | ||
| "meta": {}, | ||
| "i18n": { | ||
| "zh-CN": { | ||
| "search": "查询", | ||
| "addFrontSearch": "新增前筛", | ||
| "edit": "编辑", | ||
| "delete": "删除", | ||
| "deleteConfirm": "是否删除当前项?", | ||
| "viewHistory": "查看历史记录", | ||
| "channel": "渠道", | ||
| "checkCondition": "前筛条件", | ||
| "isEnabled": "是否开启", | ||
| "apiChannel": "API渠道", | ||
| "operatorType": "符号选择", | ||
| "value": "值", | ||
| "frontSearchDesc": "前筛", | ||
| "status": "状态", | ||
| "id": "ID", | ||
| "updateTime": "更新时间", | ||
| "operation": "操作", | ||
| "addFrontSearchTitle": "新增前筛选择", | ||
| "editFrontSearchTitle": "编辑前筛选择", | ||
| "deleteSuccess": "删除成功!", | ||
| "historyLog": "历史操作记录", | ||
| "operator": "操作人" | ||
| } | ||
| }, | ||
| "hidden": false, | ||
| "title": "页面", | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "fileName": "/", | ||
| "conditionGroup": "", | ||
| "i18n": { | ||
| "zh-CN": { | ||
| "hello": "你好" | ||
| }, | ||
| "en-US": { | ||
| "hello": "hello" | ||
| } | ||
| }, | ||
| "children": [ | ||
| { | ||
| "componentName": "FormilyForm", | ||
| "id": "node_ocm99odwi92", | ||
| "componentName": "EnumConfig", | ||
| "id": "node_ocmh948hp25", | ||
| "props": { | ||
| "configName": "布尔类型枚举", | ||
| "enumRequest": "({setEnum}) => {\n setEnum('BooleanTypeEnum', [\n { label: '是', value: 'TRUE' },\n { label: '否', value: 'FALSE' }\n ]);\n}" | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "" | ||
| }, | ||
| { | ||
| "componentName": "PreConfig", | ||
| "id": "node_ocmhbxdj8gj", | ||
| "props": { | ||
| "configName": "翻译前缀配置", | ||
| "preJsonConfig": { | ||
| "lcUniquePre": "lowCodeTranslate.uniqueName" | ||
| } | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "" | ||
| }, | ||
| { | ||
| "componentName": "FormilyFormNew", | ||
| "id": "node_ocmhbnhjvc1", | ||
| "props": { | ||
| "labelCol": 3, | ||
@@ -28,3 +75,3 @@ "wrapperCol": 14, | ||
| "width": "100%", | ||
| "formUniqueKey": "form-bodlahyj", | ||
| "formUniqueKey": "form-k0fhyc", | ||
| "tableData": { | ||
@@ -34,8 +81,61 @@ "type": "JSExpression", | ||
| }, | ||
| "showBtnSlot": { | ||
| "type": "JSSlot", | ||
| "params": [ | ||
| "data" | ||
| ], | ||
| "value": [ | ||
| { | ||
| "componentName": "FormilyButton", | ||
| "id": "node_ocmhbnhjvc8", | ||
| "props": { | ||
| "label": "按钮", | ||
| "type": "default", | ||
| "secondCheck": false, | ||
| "secondCheckText": "是否确认操作?", | ||
| "buttonType": "reset", | ||
| "propsData": { | ||
| "type": "JSExpression", | ||
| "value": "this.data" | ||
| }, | ||
| "size": "middle", | ||
| "style": { | ||
| "marginRight": "12px" | ||
| } | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "" | ||
| }, | ||
| { | ||
| "componentName": "FormilyButton", | ||
| "id": "node_ocmhbnhjvc9", | ||
| "props": { | ||
| "label": "按钮", | ||
| "type": "default", | ||
| "secondCheck": false, | ||
| "secondCheckText": "是否确认操作?", | ||
| "buttonType": "submit", | ||
| "propsData": { | ||
| "type": "JSExpression", | ||
| "value": "this.data" | ||
| }, | ||
| "size": "middle" | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "" | ||
| } | ||
| ], | ||
| "id": "node_ocm9sebfur3" | ||
| }, | ||
| "size": "middle", | ||
| "colon": false, | ||
| "clearLabelSpace": false, | ||
| "broadcast": true, | ||
| "emitEventName": "", | ||
| "initFetch": true | ||
| "initFetch": false | ||
| }, | ||
@@ -50,12 +150,12 @@ "hidden": false, | ||
| "componentName": "FormilyInput", | ||
| "id": "node_ocm99odwi93", | ||
| "id": "node_ocmhbnhjvc4", | ||
| "props": { | ||
| "showLabel": false, | ||
| "label": "a", | ||
| "showLabel": true, | ||
| "label": "$(lcUniquePre).name", | ||
| "required": false, | ||
| "name": "condition", | ||
| "name": "name", | ||
| "defaultValue": "", | ||
| "placeholder": "设备名称、系统、设备ID、描述", | ||
| "pattern": "", | ||
| "validator": "" | ||
| "validator": "", | ||
| "width": "" | ||
| }, | ||
@@ -67,2 +167,64 @@ "hidden": false, | ||
| "conditionGroup": "" | ||
| }, | ||
| { | ||
| "componentName": "FormSelect", | ||
| "id": "node_ocmhbnhjvc5", | ||
| "props": { | ||
| "showLabel": true, | ||
| "label": "下拉选择", | ||
| "required": false, | ||
| "name": "Select", | ||
| "options": [ | ||
| { | ||
| "label": "选项1", | ||
| "value": "1" | ||
| }, | ||
| { | ||
| "label": "选项名", | ||
| "value": "2", | ||
| "disabled": false | ||
| } | ||
| ], | ||
| "pattern": "", | ||
| "validator": "", | ||
| "width": "", | ||
| "openTooltip": false, | ||
| "mode": "multiple", | ||
| "showSearch": false, | ||
| "virtual": false, | ||
| "selectAll": false, | ||
| "autoClearSearchValue": true | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "" | ||
| }, | ||
| { | ||
| "componentName": "FormRangePicker", | ||
| "id": "node_ocmhbnhjvc7", | ||
| "props": { | ||
| "showLabel": true, | ||
| "label": "日期范围选择", | ||
| "required": false, | ||
| "showTime": false, | ||
| "showTimeStartDefaultValue": "00:00:00, HH:mm:ss", | ||
| "showTimeEndDefaultValue": "23:59:59, HH:mm:ss", | ||
| "showNow": false, | ||
| "showToday": false, | ||
| "name": "rangePicker", | ||
| "defaultValue": [], | ||
| "picker": "date", | ||
| "format": "YYYY-MM-DD HH:mm:ss", | ||
| "resolveFunc": "([startDate, endDate]) => (\n {\n startDate: new Date(startDate).getTime(),\n endDate: new Date(endDate).getTime() \n }\n)", | ||
| "pattern": "", | ||
| "validator": "", | ||
| "width": "" | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "" | ||
| } | ||
@@ -73,56 +235,7 @@ ] | ||
| "componentName": "FormilyTable", | ||
| "id": "node_ocm99odwi97", | ||
| "id": "node_ocmh948hp26", | ||
| "props": { | ||
| "eventName": "", | ||
| "eventName": "frontSearchTableRefresh", | ||
| "bordered": true, | ||
| "dataSource": [], | ||
| "openSlot": { | ||
| "type": "JSSlot", | ||
| "params": [ | ||
| "data" | ||
| ], | ||
| "value": [ | ||
| { | ||
| "componentName": "FormilyButton", | ||
| "id": "node_ocm99odwi92o", | ||
| "props": { | ||
| "label": "批量删除", | ||
| "type": "default", | ||
| "secondCheck": true, | ||
| "secondCheckText": "是否确认删除这些设备?", | ||
| "buttonType": "control", | ||
| "propsData": { | ||
| "type": "JSExpression", | ||
| "value": "this.data" | ||
| }, | ||
| "openBatch": true, | ||
| "requestConfig": { | ||
| "url": "/appflux/devices/batchDelete", | ||
| "method": "POST", | ||
| "dataFormat": "JSON", | ||
| "showRequestData": true, | ||
| "showResponseData": false, | ||
| "showGeneralResponseData": false, | ||
| "headersList": [], | ||
| "headers": {}, | ||
| "requestDataFunc": "function (params) {\n return {\n ids:params.ids\n }\n}", | ||
| "responseDataFunc": "", | ||
| "responseGeneralDataFunc": "", | ||
| "showRequestCondition": false, | ||
| "requestConditionFunc": "" | ||
| }, | ||
| "broadcast": true, | ||
| "dangerBtn": true, | ||
| "size": "middle", | ||
| "batchParamName": "ids" | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "" | ||
| } | ||
| ], | ||
| "id": "node_ocm99odwi98" | ||
| }, | ||
| "previewDataSource": [], | ||
| "columns": [ | ||
@@ -132,35 +245,20 @@ { | ||
| "dataIndex": "id", | ||
| "key": "id" | ||
| "key": "id", | ||
| "align": "center", | ||
| "width": 80, | ||
| "ellipsis": false | ||
| }, | ||
| { | ||
| "title": "设备名称", | ||
| "dataIndex": "deviceName", | ||
| "key": "deviceName" | ||
| }, | ||
| { | ||
| "title": "描述", | ||
| "title": "前筛", | ||
| "dataIndex": "desc", | ||
| "key": "desc" | ||
| "key": "desc", | ||
| "align": "center", | ||
| "ellipsis": false | ||
| }, | ||
| { | ||
| "title": "设备ID", | ||
| "dataIndex": "deviceId", | ||
| "key": "deviceId" | ||
| }, | ||
| { | ||
| "title": "系统", | ||
| "dataIndex": "system", | ||
| "key": "system" | ||
| }, | ||
| { | ||
| "title": "绑定用户", | ||
| "dataIndex": "userId", | ||
| "key": "userId" | ||
| }, | ||
| { | ||
| "title": "绑定时间", | ||
| "dataIndex": "createdAt", | ||
| "key": "createdAt", | ||
| "align": "left", | ||
| "fixed": "", | ||
| "title": "状态", | ||
| "dataIndex": "status", | ||
| "key": "status", | ||
| "align": "center", | ||
| "width": 100, | ||
| "ellipsis": false, | ||
@@ -175,3 +273,3 @@ "customRender": { | ||
| "componentName": "FormText", | ||
| "id": "node_ocm99odwi916", | ||
| "id": "node_ocmh948hp21k", | ||
| "props": { | ||
@@ -183,6 +281,4 @@ "propsData": { | ||
| "type": "onlyText", | ||
| "textField": "", | ||
| "popoverField": "", | ||
| "text": "", | ||
| "textFieldResolve": "(text) => dayjs(text).format('YYYY-MM-DD HH:mm:ss')" | ||
| "textField": "status", | ||
| "enumMap": "BooleanTypeEnum" | ||
| }, | ||
@@ -196,11 +292,11 @@ "hidden": false, | ||
| ], | ||
| "id": "node_ocm99odwi915" | ||
| "id": "node_ocmh948hp21j" | ||
| } | ||
| }, | ||
| { | ||
| "title": "更新时间", | ||
| "dataIndex": "updatedAt", | ||
| "key": "updatedAt", | ||
| "align": "left", | ||
| "fixed": "", | ||
| "title": "渠道", | ||
| "dataIndex": "sdkType", | ||
| "key": "sdkType", | ||
| "align": "center", | ||
| "width": 150, | ||
| "ellipsis": false, | ||
@@ -215,3 +311,3 @@ "customRender": { | ||
| "componentName": "FormText", | ||
| "id": "node_ocm99odwi918", | ||
| "id": "node_ocmh948hp21m", | ||
| "props": { | ||
@@ -223,6 +319,4 @@ "propsData": { | ||
| "type": "onlyText", | ||
| "textField": "", | ||
| "popoverField": "", | ||
| "text": "", | ||
| "textFieldResolve": "(text) => dayjs(text).format('YYYY-MM-DD HH:mm:ss')" | ||
| "textField": "sdkType", | ||
| "enumMap": "SdkTypeEnum" | ||
| }, | ||
@@ -236,375 +330,11 @@ "hidden": false, | ||
| ], | ||
| "id": "node_ocm99odwi917" | ||
| "id": "node_ocmh948hp21l" | ||
| } | ||
| }, | ||
| { | ||
| "title": "操作", | ||
| "dataIndex": "action", | ||
| "align": "left", | ||
| "fixed": "", | ||
| "ellipsis": false, | ||
| "customRender": { | ||
| "type": "JSSlot", | ||
| "params": [ | ||
| "data" | ||
| ], | ||
| "value": [ | ||
| { | ||
| "componentName": "FormilyFormModalNew", | ||
| "id": "node_ocmanj9zta1hu", | ||
| "props": { | ||
| "label": "编辑", | ||
| "shouldInitialValue": true, | ||
| "onlyRead": false, | ||
| "type": "default", | ||
| "modalWidth": "800px", | ||
| "tableData": { | ||
| "type": "JSExpression", | ||
| "value": "this.data" | ||
| }, | ||
| "openSlot": { | ||
| "type": "JSSlot", | ||
| "params": [ | ||
| "data" | ||
| ], | ||
| "value": [ | ||
| { | ||
| "componentName": "FormilyFormNew", | ||
| "id": "node_ocmanj9zta23c", | ||
| "props": { | ||
| "labelCol": 13, | ||
| "wrapperCol": 14, | ||
| "layout": "vertical", | ||
| "width": "100%", | ||
| "formUniqueKey": "form-k8hk5cd7", | ||
| "tableData": { | ||
| "type": "JSExpression", | ||
| "value": "this.data" | ||
| }, | ||
| "showBtnSlot": { | ||
| "type": "JSSlot", | ||
| "params": [ | ||
| "data" | ||
| ], | ||
| "id": "node_ocmanj9zta23d" | ||
| }, | ||
| "hiddenFormButtonConfig": true, | ||
| "size": "middle", | ||
| "colon": false, | ||
| "clearLabelSpace": false, | ||
| "emitEventName": "", | ||
| "initFetch": false | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "", | ||
| "children": [ | ||
| { | ||
| "componentName": "FormilyInput", | ||
| "id": "node_ocmanjbosc4", | ||
| "props": { | ||
| "showLabel": true, | ||
| "label": "设备名称", | ||
| "required": false, | ||
| "name": "deviceName", | ||
| "defaultValue": "", | ||
| "pattern": "", | ||
| "validator": "" | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "" | ||
| }, | ||
| { | ||
| "componentName": "FormTextarea", | ||
| "id": "node_ocmanjbosc5", | ||
| "props": { | ||
| "label": "描述", | ||
| "required": false, | ||
| "name": "desc", | ||
| "defaultValue": "", | ||
| "autoSize": false, | ||
| "showLabel": true, | ||
| "pattern": "", | ||
| "validator": "", | ||
| "minRows": 2, | ||
| "maxRows": 6 | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "" | ||
| }, | ||
| { | ||
| "componentName": "FormilyInput", | ||
| "id": "node_ocmanjbosc6", | ||
| "props": { | ||
| "showLabel": true, | ||
| "label": "系统", | ||
| "required": false, | ||
| "name": "system", | ||
| "defaultValue": "", | ||
| "pattern": "", | ||
| "validator": "" | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "" | ||
| } | ||
| ] | ||
| } | ||
| ], | ||
| "id": "node_ocmanj9zta1hv" | ||
| }, | ||
| "size": "small", | ||
| "requestConfig": { | ||
| "url": "/appflux/devices/update", | ||
| "method": "POST", | ||
| "dataFormat": "JSON", | ||
| "showRequestData": false, | ||
| "showResponseData": false, | ||
| "showGeneralResponseData": false, | ||
| "headersList": [], | ||
| "headers": {}, | ||
| "requestDataFunc": "", | ||
| "responseDataFunc": "", | ||
| "responseGeneralDataFunc": "", | ||
| "showRequestCondition": false, | ||
| "requestConditionFunc": "" | ||
| }, | ||
| "broadcast": true | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "" | ||
| }, | ||
| { | ||
| "componentName": "FormilyButton", | ||
| "id": "node_ocm99odwi91a", | ||
| "props": { | ||
| "label": "删除", | ||
| "type": "primary", | ||
| "secondCheck": true, | ||
| "secondCheckText": "是否确认删除设备?", | ||
| "buttonType": "control", | ||
| "propsData": { | ||
| "type": "JSExpression", | ||
| "value": "this.data" | ||
| }, | ||
| "dangerBtn": true, | ||
| "size": "small", | ||
| "requestConfig": { | ||
| "url": "/appflux/devices/delete", | ||
| "method": "POST", | ||
| "dataFormat": "JSON", | ||
| "showRequestData": true, | ||
| "showResponseData": false, | ||
| "showGeneralResponseData": false, | ||
| "headersList": [], | ||
| "headers": {}, | ||
| "requestDataFunc": "function (params) {\n return {\n id: params.id\n }\n}", | ||
| "responseDataFunc": "", | ||
| "responseGeneralDataFunc": "", | ||
| "showRequestCondition": false, | ||
| "requestConditionFunc": "" | ||
| }, | ||
| "broadcast": true | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "" | ||
| } | ||
| ], | ||
| "id": "node_ocm99odwi919" | ||
| }, | ||
| "width": 200 | ||
| } | ||
| ], | ||
| "rowKey": "id", | ||
| "pagination": { | ||
| "pageSize": 10, | ||
| "total": 15, | ||
| "current": 1 | ||
| }, | ||
| "openRowSelection": true, | ||
| "requestOnMount": false, | ||
| "hiddenOnNoRequest": false, | ||
| "supportScroll": false, | ||
| "showHeader": true, | ||
| "bordered": true, | ||
| "size": "default", | ||
| "tableLayout": "", | ||
| "supportScrollX": 1000, | ||
| "recordData": { | ||
| "type": "JSExpression", | ||
| "value": "this.data" | ||
| }, | ||
| "requestConfig": { | ||
| "url": "/appflux/devices/getList", | ||
| "method": "GET", | ||
| "dataFormat": "JSON", | ||
| "showRequestData": false, | ||
| "showResponseData": true, | ||
| "showGeneralResponseData": false, | ||
| "headersList": [], | ||
| "headers": {}, | ||
| "requestDataFunc": "", | ||
| "responseDataFunc": "function(response, data){\n // 这里写你的处理逻辑\n // response 就是 axios 的原始结构 { data: { status, body } }\n // data 是请求时传入的参数,包函了排序参数等\n return {\n status: response.data.status,\n body: {\n data: response.data.body.list,\n total: response.data.body.total\n }\n }\n}", | ||
| "responseGeneralDataFunc": "", | ||
| "showRequestCondition": false, | ||
| "requestConditionFunc": "" | ||
| }, | ||
| "showSelectionSelectAll": true, | ||
| "clearSelectedRowKeysOnRefresh": true, | ||
| "pageSizeOptions": "10,20,50,100", | ||
| "columnSetting": false, | ||
| "globalSelectAll": false | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "" | ||
| }, | ||
| { | ||
| "componentName": "FormilyTable", | ||
| "id": "node_ocme9w0xkx1", | ||
| "props": { | ||
| "eventName": "", | ||
| "dataSource": [], | ||
| "openSlot": { | ||
| "type": "JSSlot", | ||
| "params": [ | ||
| "data" | ||
| ], | ||
| "value": [ | ||
| { | ||
| "componentName": "TableSearchForm", | ||
| "id": "node_ocme9w0xkxv", | ||
| "props": { | ||
| "filterType": "static", | ||
| "propsData": { | ||
| "type": "JSExpression", | ||
| "value": "this.data" | ||
| }, | ||
| "width": "100%", | ||
| "colon": false, | ||
| "staticRules": "\n// ({filterTableData: (v: Array)=>void, formData, allDataList}) => any\n\n// 示例 根据status过滤\n({formData, allDataList, filterTableData}) => {\n if (formData.status === '1') {\n filterTableData(allDataList.filter((v) => v.status === 1));\n }else if (formData.status === '2') {\n filterTableData(allDataList.filter((v) => v.status === 2));\n }else {\n filterTableData(allDataList);\n }\n}\n" | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "", | ||
| "children": [ | ||
| { | ||
| "componentName": "FormilyInput", | ||
| "id": "node_ocme9w0xkxw", | ||
| "props": { | ||
| "label": "Input", | ||
| "required": false, | ||
| "name": "Input", | ||
| "defaultValue": "", | ||
| "showLabel": true, | ||
| "pattern": "", | ||
| "validator": "", | ||
| "width": "" | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "" | ||
| } | ||
| ] | ||
| } | ||
| ], | ||
| "id": "node_ocme9w0xkx2" | ||
| }, | ||
| "previewDataSource": [], | ||
| "columns": [ | ||
| { | ||
| "title": "ID", | ||
| "dataIndex": "id", | ||
| "key": "id" | ||
| }, | ||
| { | ||
| "title": "设备名称", | ||
| "dataIndex": "deviceName", | ||
| "key": "deviceName" | ||
| }, | ||
| { | ||
| "title": "描述", | ||
| "dataIndex": "desc", | ||
| "key": "desc" | ||
| }, | ||
| { | ||
| "title": "设备ID", | ||
| "dataIndex": "deviceId", | ||
| "key": "deviceId" | ||
| }, | ||
| { | ||
| "title": "系统", | ||
| "dataIndex": "system", | ||
| "key": "system" | ||
| }, | ||
| { | ||
| "title": "绑定用户", | ||
| "dataIndex": "userId", | ||
| "key": "userId" | ||
| }, | ||
| { | ||
| "title": "绑定时间", | ||
| "dataIndex": "createdAt", | ||
| "key": "createdAt", | ||
| "align": "left", | ||
| "fixed": "", | ||
| "ellipsis": false, | ||
| "customRender": { | ||
| "type": "JSSlot", | ||
| "params": [ | ||
| "data" | ||
| ], | ||
| "value": [ | ||
| { | ||
| "componentName": "FormText", | ||
| "id": "node_ocme9w0xkxj", | ||
| "props": { | ||
| "propsData": { | ||
| "type": "JSExpression", | ||
| "value": "this.data" | ||
| }, | ||
| "type": "onlyText", | ||
| "textField": "", | ||
| "popoverField": "", | ||
| "text": "", | ||
| "textFieldResolve": "(text) => dayjs(text).format('YYYY-MM-DD HH:mm:ss')" | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "" | ||
| } | ||
| ], | ||
| "id": "node_ocme9w0xkxi" | ||
| } | ||
| }, | ||
| { | ||
| "title": "更新时间", | ||
| "dataIndex": "updatedAt", | ||
| "key": "updatedAt", | ||
| "align": "left", | ||
| "fixed": "", | ||
| "dataIndex": "timeUpdated", | ||
| "key": "timeUpdated", | ||
| "align": "center", | ||
| "width": 180, | ||
| "ellipsis": false, | ||
@@ -619,3 +349,3 @@ "customRender": { | ||
| "componentName": "FormText", | ||
| "id": "node_ocme9w0xkxl", | ||
| "id": "node_ocmh948hp21o", | ||
| "props": { | ||
@@ -627,6 +357,4 @@ "propsData": { | ||
| "type": "onlyText", | ||
| "textField": "", | ||
| "popoverField": "", | ||
| "text": "", | ||
| "textFieldResolve": "(text) => dayjs(text).format('YYYY-MM-DD HH:mm:ss')" | ||
| "textField": "timeUpdated", | ||
| "textFieldResolve": "(text) => text ? new Date(text).toLocaleString('zh-CN', { hour12: false }) : '-'" | ||
| }, | ||
@@ -640,3 +368,3 @@ "hidden": false, | ||
| ], | ||
| "id": "node_ocme9w0xkxk" | ||
| "id": "node_ocmh948hp21n" | ||
| } | ||
@@ -646,5 +374,5 @@ }, | ||
| "title": "操作", | ||
| "dataIndex": "action", | ||
| "align": "left", | ||
| "fixed": "", | ||
| "align": "center", | ||
| "fixed": "right", | ||
| "width": 300, | ||
| "ellipsis": false, | ||
@@ -659,3 +387,3 @@ "customRender": { | ||
| "componentName": "FormilyFormModalNew", | ||
| "id": "node_ocme9w0xkxn", | ||
| "id": "node_ocmh948hp21q", | ||
| "props": { | ||
@@ -665,4 +393,5 @@ "label": "编辑", | ||
| "onlyRead": false, | ||
| "type": "default", | ||
| "modalWidth": "800px", | ||
| "type": "primary", | ||
| "modalWidth": "600px", | ||
| "modalTitle": "编辑前筛选择", | ||
| "tableData": { | ||
@@ -672,2 +401,18 @@ "type": "JSExpression", | ||
| }, | ||
| "size": "small", | ||
| "customCondtion": "() => window.lcMicroAppProps?.hasUpdatePermission === true", | ||
| "hidenWithNoPermission": false, | ||
| "broadcast": true, | ||
| "emitEventName": "frontSearchTableRefresh", | ||
| "requestConfig": { | ||
| "url": "/loan/admin/operation/cashloan/precheck/update", | ||
| "method": "POST", | ||
| "dataFormat": "JSON", | ||
| "showRequestData": true, | ||
| "showResponseData": false, | ||
| "showGeneralResponseData": false, | ||
| "requestDataFunc": "async function(data, formInstance, util, requestConfig) {\n const { sdkType, checkItem, operatorType, data: dataValue, desc, status, id } = data || {};\n return {\n id,\n sdkType,\n checkItem,\n operatorType,\n data: dataValue || '',\n desc,\n status\n };\n}", | ||
| "headers": {}, | ||
| "headersList": [] | ||
| }, | ||
| "openSlot": { | ||
@@ -681,9 +426,8 @@ "type": "JSSlot", | ||
| "componentName": "FormilyFormNew", | ||
| "id": "node_ocme9w0xkxp", | ||
| "id": "node_ocmh948hp21s", | ||
| "props": { | ||
| "labelCol": 13, | ||
| "wrapperCol": 14, | ||
| "layout": "vertical", | ||
| "labelCol": 6, | ||
| "wrapperCol": 16, | ||
| "layout": "horizontal", | ||
| "width": "100%", | ||
| "formUniqueKey": "form-k8hk5cd7", | ||
| "tableData": { | ||
@@ -693,15 +437,9 @@ "type": "JSExpression", | ||
| }, | ||
| "showBtnSlot": { | ||
| "type": "JSSlot", | ||
| "params": [ | ||
| "data" | ||
| ], | ||
| "id": "node_ocme9w0xkxq" | ||
| }, | ||
| "hiddenFormButtonConfig": true, | ||
| "size": "middle", | ||
| "colon": false, | ||
| "colon": true, | ||
| "clearLabelSpace": false, | ||
| "emitEventName": "", | ||
| "initFetch": false | ||
| "initFetch": false, | ||
| "broadcast": false | ||
| }, | ||
@@ -715,12 +453,24 @@ "hidden": false, | ||
| { | ||
| "componentName": "FormilyInput", | ||
| "id": "node_ocme9w0xkxr", | ||
| "componentName": "FormSelect", | ||
| "id": "node_ocmh948hp21t", | ||
| "props": { | ||
| "showLabel": true, | ||
| "label": "设备名称", | ||
| "required": false, | ||
| "name": "deviceName", | ||
| "label": "API渠道", | ||
| "required": true, | ||
| "message": "请选择API渠道", | ||
| "name": "sdkType", | ||
| "enumName": "SdkTypeEnum", | ||
| "mode": "combobox", | ||
| "showSearch": false, | ||
| "disabled": true, | ||
| "allowClear": false, | ||
| "placeholder": "请选择API渠道", | ||
| "width": "", | ||
| "defaultValue": "", | ||
| "pattern": "", | ||
| "validator": "" | ||
| "validator": "", | ||
| "virtual": false, | ||
| "openTooltip": false, | ||
| "selectAll": false, | ||
| "autoClearSearchValue": true | ||
| }, | ||
@@ -734,15 +484,24 @@ "hidden": false, | ||
| { | ||
| "componentName": "FormTextarea", | ||
| "id": "node_ocme9w0xkxs", | ||
| "componentName": "FormSelect", | ||
| "id": "node_ocmh948hp21u", | ||
| "props": { | ||
| "label": "描述", | ||
| "required": false, | ||
| "name": "desc", | ||
| "showLabel": true, | ||
| "label": "前筛条件", | ||
| "required": true, | ||
| "message": "请选择前筛条件", | ||
| "name": "checkItem", | ||
| "enumName": "CheckItemEnum", | ||
| "mode": "combobox", | ||
| "showSearch": false, | ||
| "disabled": true, | ||
| "allowClear": false, | ||
| "placeholder": "请选择前筛条件", | ||
| "width": "", | ||
| "defaultValue": "", | ||
| "autoSize": false, | ||
| "showLabel": true, | ||
| "pattern": "", | ||
| "validator": "", | ||
| "minRows": 2, | ||
| "maxRows": 6 | ||
| "virtual": false, | ||
| "openTooltip": false, | ||
| "selectAll": false, | ||
| "autoClearSearchValue": true | ||
| }, | ||
@@ -756,12 +515,24 @@ "hidden": false, | ||
| { | ||
| "componentName": "FormilyInput", | ||
| "id": "node_ocme9w0xkxt", | ||
| "componentName": "FormSelect", | ||
| "id": "node_ocmh948hp21v", | ||
| "props": { | ||
| "showLabel": true, | ||
| "label": "系统", | ||
| "required": false, | ||
| "name": "system", | ||
| "label": "符号选择", | ||
| "required": true, | ||
| "message": "请选择符号", | ||
| "name": "operatorType", | ||
| "enumName": "OperatorTypeEnum", | ||
| "mode": "combobox", | ||
| "showSearch": false, | ||
| "disabled": true, | ||
| "allowClear": false, | ||
| "placeholder": "请选择符号", | ||
| "width": "", | ||
| "defaultValue": "", | ||
| "pattern": "", | ||
| "validator": "" | ||
| "validator": "", | ||
| "virtual": false, | ||
| "openTooltip": false, | ||
| "selectAll": false, | ||
| "autoClearSearchValue": true | ||
| }, | ||
@@ -773,247 +544,32 @@ "hidden": false, | ||
| "conditionGroup": "" | ||
| } | ||
| ] | ||
| } | ||
| ], | ||
| "id": "node_ocme9w0xkxo" | ||
| }, | ||
| "size": "small", | ||
| "requestConfig": { | ||
| "url": "/appflux/devices/update", | ||
| "method": "POST", | ||
| "dataFormat": "JSON", | ||
| "showRequestData": false, | ||
| "showResponseData": false, | ||
| "showGeneralResponseData": false, | ||
| "headersList": [], | ||
| "headers": {}, | ||
| "requestDataFunc": "", | ||
| "responseDataFunc": "", | ||
| "responseGeneralDataFunc": "", | ||
| "showRequestCondition": false, | ||
| "requestConditionFunc": "" | ||
| }, | ||
| "broadcast": true | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "" | ||
| }, | ||
| { | ||
| "componentName": "FormilyButton", | ||
| "id": "node_ocme9w0xkxu", | ||
| "props": { | ||
| "label": "删除", | ||
| "type": "primary", | ||
| "secondCheck": true, | ||
| "secondCheckText": "是否确认删除设备?", | ||
| "buttonType": "control", | ||
| "propsData": { | ||
| "type": "JSExpression", | ||
| "value": "this.data" | ||
| }, | ||
| "dangerBtn": true, | ||
| "size": "small", | ||
| "requestConfig": { | ||
| "url": "/appflux/devices/delete", | ||
| "method": "POST", | ||
| "dataFormat": "JSON", | ||
| "showRequestData": true, | ||
| "showResponseData": false, | ||
| "showGeneralResponseData": false, | ||
| "headersList": [], | ||
| "headers": {}, | ||
| "requestDataFunc": "function (params) {\n return {\n id: params.id\n }\n}", | ||
| "responseDataFunc": "", | ||
| "responseGeneralDataFunc": "", | ||
| "showRequestCondition": false, | ||
| "requestConditionFunc": "" | ||
| }, | ||
| "broadcast": true | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "" | ||
| } | ||
| ], | ||
| "id": "node_ocme9w0xkxm" | ||
| }, | ||
| "width": 200 | ||
| } | ||
| ], | ||
| "rowKey": "id", | ||
| "pagination": { | ||
| "pageSize": 10, | ||
| "total": 15, | ||
| "current": 1 | ||
| }, | ||
| "openRowSelection": false, | ||
| "requestOnMount": false, | ||
| "hiddenOnNoRequest": false, | ||
| "supportScroll": false, | ||
| "showHeader": true, | ||
| "bordered": true, | ||
| "size": "default", | ||
| "tableLayout": "", | ||
| "supportScrollX": 1000, | ||
| "recordData": { | ||
| "type": "JSExpression", | ||
| "value": "this.data" | ||
| }, | ||
| "requestConfig": { | ||
| "url": "/appflux/devices/getList", | ||
| "method": "GET", | ||
| "dataFormat": "JSON", | ||
| "showRequestData": false, | ||
| "showResponseData": true, | ||
| "showGeneralResponseData": false, | ||
| "headersList": [], | ||
| "headers": {}, | ||
| "requestDataFunc": "", | ||
| "responseDataFunc": "function(response, data){\n // 这里写你的处理逻辑\n // response 就是 axios 的原始结构 { data: { status, body } }\n // data 是请求时传入的参数,包函了排序参数等\n return {\n status: response.data.status,\n body: {\n data: response.data.body.list,\n total: response.data.body.total\n }\n }\n}", | ||
| "responseGeneralDataFunc": "", | ||
| "showRequestCondition": false, | ||
| "requestConditionFunc": "" | ||
| }, | ||
| "showSelectionSelectAll": true, | ||
| "clearSelectedRowKeysOnRefresh": true, | ||
| "pageSizeOptions": "10,20,50,100", | ||
| "columnSetting": false, | ||
| "globalSelectAll": false | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "" | ||
| }, | ||
| { | ||
| "componentName": "FormilyTable", | ||
| "id": "node_ocme9w0xkxx", | ||
| "props": { | ||
| "eventName": "", | ||
| "dataSource": [], | ||
| "openSlot": { | ||
| "type": "JSSlot", | ||
| "params": [ | ||
| "data" | ||
| ], | ||
| "value": [ | ||
| { | ||
| "componentName": "TableSearchForm", | ||
| "id": "node_ocme9w0xkx1e", | ||
| "props": { | ||
| "filterType": "request", | ||
| "propsData": { | ||
| "type": "JSExpression", | ||
| "value": "this.data" | ||
| }, | ||
| "width": "100%", | ||
| "colon": false, | ||
| "staticRules": "", | ||
| "refreshOnRequest": true | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "", | ||
| "children": [ | ||
| { | ||
| "componentName": "FormilyInput", | ||
| "id": "node_ocme9w0xkx1f", | ||
| "props": { | ||
| "label": "Input", | ||
| "required": false, | ||
| "name": "Input", | ||
| "defaultValue": "", | ||
| "showLabel": true, | ||
| "pattern": "", | ||
| "validator": "", | ||
| "width": "" | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "" | ||
| }, | ||
| { | ||
| "componentName": "FormilyFormModalNew", | ||
| "id": "node_ocme9w0xkx1t", | ||
| "props": { | ||
| "label": "弹窗触发按钮", | ||
| "shouldInitialValue": false, | ||
| "onlyRead": false, | ||
| "type": "default", | ||
| "modalWidth": "800px", | ||
| "tableData": { | ||
| "type": "JSExpression", | ||
| "value": "this.data" | ||
| }, | ||
| "openSlot": { | ||
| "type": "JSSlot", | ||
| "params": [ | ||
| "data" | ||
| ], | ||
| "value": [ | ||
| { | ||
| "componentName": "FormilyFormNew", | ||
| "id": "node_ocme9w0xkx20", | ||
| "props": { | ||
| "labelCol": 13, | ||
| "wrapperCol": 14, | ||
| "layout": "vertical", | ||
| "width": "100%", | ||
| "tableData": { | ||
| "type": "JSExpression", | ||
| "value": "this.data" | ||
| }, | ||
| "hiddenFormButtonConfig": true, | ||
| "size": "middle", | ||
| "colon": false, | ||
| "clearLabelSpace": false, | ||
| "emitEventName": "", | ||
| "initFetch": false | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "", | ||
| "children": [ | ||
| { | ||
| "componentName": "FormilyInput", | ||
| "id": "node_ocme9w0xkx21", | ||
| "id": "node_ocmh948hp21w", | ||
| "props": { | ||
| "showLabel": true, | ||
| "label": "姓名", | ||
| "required": false, | ||
| "name": "name", | ||
| "defaultValue": "" | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "" | ||
| }, | ||
| { | ||
| "componentName": "FormSelect", | ||
| "id": "node_ocme9w0xkx22", | ||
| "props": { | ||
| "showLabel": true, | ||
| "label": "下拉选择", | ||
| "required": false, | ||
| "name": "Select", | ||
| "options": [ | ||
| { | ||
| "label": "选项1", | ||
| "value": "1" | ||
| "label": "值", | ||
| "required": true, | ||
| "message": "请输入值", | ||
| "name": "data", | ||
| "placeholder": "请输入值", | ||
| "allowClear": true, | ||
| "width": "", | ||
| "defaultValue": "", | ||
| "pattern": "", | ||
| "validator": "", | ||
| "reactionsSetter": { | ||
| "dependencies": [ | ||
| { | ||
| "property": "value", | ||
| "type": "any", | ||
| "source": "operatorType", | ||
| "name": "operatorType" | ||
| } | ||
| ], | ||
| "fulfill": { | ||
| "run": "$effect(() => {\n const hiddenValues = ['NOT_BLANK', 'BLANK'];\n $self.visible = !hiddenValues.includes($deps.operatorType);\n}, [$deps.operatorType])", | ||
| "state": {} | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
@@ -1027,17 +583,16 @@ "hidden": false, | ||
| { | ||
| "componentName": "FormilyDatePicker", | ||
| "id": "node_ocme9w0xkx23", | ||
| "componentName": "FormilyInput", | ||
| "id": "node_ocmh948hp21x", | ||
| "props": { | ||
| "showLabel": true, | ||
| "label": "日期选择", | ||
| "label": "前筛", | ||
| "required": false, | ||
| "showTime": false, | ||
| "showNow": false, | ||
| "showToday": false, | ||
| "name": "datePicker", | ||
| "name": "desc", | ||
| "disabled": true, | ||
| "placeholder": "自动生成", | ||
| "allowClear": false, | ||
| "width": "", | ||
| "defaultValue": "", | ||
| "picker": "date", | ||
| "format": "YYYY-MM-DD HH:mm:ss", | ||
| "showTimeDefaultValue": "00:00:00, HH:mm:ss", | ||
| "resolveFunc": "(timeStr) => new Date(timeStr).getTime()" | ||
| "pattern": "", | ||
| "validator": "" | ||
| }, | ||
@@ -1051,18 +606,22 @@ "hidden": false, | ||
| { | ||
| "componentName": "FormRangePicker", | ||
| "id": "node_ocme9w0xkx24", | ||
| "componentName": "FormSelect", | ||
| "id": "node_ocmh948hp21y", | ||
| "props": { | ||
| "showLabel": true, | ||
| "label": "日期范围选择", | ||
| "label": "状态", | ||
| "required": false, | ||
| "showTime": false, | ||
| "showTimeStartDefaultValue": "00:00:00, HH:mm:ss", | ||
| "showTimeEndDefaultValue": "23:59:59, HH:mm:ss", | ||
| "showNow": false, | ||
| "showToday": false, | ||
| "name": "rangePicker", | ||
| "defaultValue": [], | ||
| "picker": "date", | ||
| "format": "YYYY-MM-DD HH:mm:ss", | ||
| "resolveFunc": "([startDate, endDate]) => (\n {\n startDate: new Date(startDate).getTime(),\n endDate: new Date(endDate).getTime() \n }\n)" | ||
| "name": "status", | ||
| "enumName": "BooleanTypeEnum", | ||
| "mode": "combobox", | ||
| "showSearch": false, | ||
| "allowClear": false, | ||
| "placeholder": "请选择状态", | ||
| "width": "", | ||
| "defaultValue": "", | ||
| "pattern": "", | ||
| "validator": "", | ||
| "virtual": false, | ||
| "openTooltip": false, | ||
| "selectAll": false, | ||
| "autoClearSearchValue": true | ||
| }, | ||
@@ -1078,35 +637,3 @@ "hidden": false, | ||
| ], | ||
| "id": "node_ocme9w0xkx1u" | ||
| }, | ||
| "size": "middle", | ||
| "hiddenCancel": true, | ||
| "footer": { | ||
| "type": "JSSlot", | ||
| "params": [ | ||
| "data" | ||
| ], | ||
| "value": [ | ||
| { | ||
| "componentName": "FormilyButton", | ||
| "id": "node_ocme9w0xkx3r", | ||
| "props": { | ||
| "label": "按钮", | ||
| "type": "default", | ||
| "secondCheck": false, | ||
| "secondCheckText": "是否确认操作?", | ||
| "buttonType": "control", | ||
| "propsData": { | ||
| "type": "JSExpression", | ||
| "value": "this.data" | ||
| }, | ||
| "size": "middle" | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "" | ||
| } | ||
| ], | ||
| "id": "node_ocme9w0xkx25" | ||
| "id": "node_ocmh948hp21r" | ||
| } | ||
@@ -1119,57 +646,12 @@ }, | ||
| "conditionGroup": "" | ||
| } | ||
| ] | ||
| } | ||
| ], | ||
| "id": "node_ocme9w0xkxy" | ||
| }, | ||
| "previewDataSource": [], | ||
| "columns": [ | ||
| { | ||
| "title": "ID", | ||
| "dataIndex": "id", | ||
| "key": "id" | ||
| }, | ||
| { | ||
| "title": "设备名称", | ||
| "dataIndex": "deviceName", | ||
| "key": "deviceName" | ||
| }, | ||
| { | ||
| "title": "描述", | ||
| "dataIndex": "desc", | ||
| "key": "desc" | ||
| }, | ||
| { | ||
| "title": "设备ID", | ||
| "dataIndex": "deviceId", | ||
| "key": "deviceId" | ||
| }, | ||
| { | ||
| "title": "系统", | ||
| "dataIndex": "system", | ||
| "key": "system" | ||
| }, | ||
| { | ||
| "title": "绑定用户", | ||
| "dataIndex": "userId", | ||
| "key": "userId" | ||
| }, | ||
| { | ||
| "title": "绑定时间", | ||
| "dataIndex": "createdAt", | ||
| "key": "createdAt", | ||
| "align": "left", | ||
| "fixed": "", | ||
| "ellipsis": false, | ||
| "customRender": { | ||
| "type": "JSSlot", | ||
| "params": [ | ||
| "data" | ||
| ], | ||
| "value": [ | ||
| }, | ||
| { | ||
| "componentName": "FormText", | ||
| "id": "node_ocme9w0xkx1h", | ||
| "componentName": "FormilyButton", | ||
| "id": "node_ocmh948hp21z", | ||
| "props": { | ||
| "label": "删除", | ||
| "type": "default", | ||
| "secondCheck": true, | ||
| "secondCheckText": "是否删除当前项?", | ||
| "buttonType": "control", | ||
| "propsData": { | ||
@@ -1179,7 +661,21 @@ "type": "JSExpression", | ||
| }, | ||
| "type": "onlyText", | ||
| "textField": "", | ||
| "popoverField": "", | ||
| "text": "", | ||
| "textFieldResolve": "(text) => dayjs(text).format('YYYY-MM-DD HH:mm:ss')" | ||
| "broadcast": true, | ||
| "emitEventName": "frontSearchTableRefresh", | ||
| "dangerBtn": true, | ||
| "size": "small", | ||
| "customCondtion": "() => window.lcMicroAppProps?.hasUpdatePermission === true", | ||
| "hidenWithNoPermission": false, | ||
| "ghost": false, | ||
| "placement": "right", | ||
| "requestConfig": { | ||
| "url": "/loan/admin/operation/cashloan/precheck/delete", | ||
| "method": "POST", | ||
| "dataFormat": "JSON", | ||
| "showRequestData": true, | ||
| "showResponseData": false, | ||
| "showGeneralResponseData": false, | ||
| "requestDataFunc": "async function(data, formInstance, util, requestConfig) {\n return { id: data.record.id };\n}", | ||
| "headers": {}, | ||
| "headersList": [] | ||
| } | ||
| }, | ||
@@ -1191,65 +687,13 @@ "hidden": false, | ||
| "conditionGroup": "" | ||
| } | ||
| ], | ||
| "id": "node_ocme9w0xkx1g" | ||
| } | ||
| }, | ||
| { | ||
| "title": "更新时间", | ||
| "dataIndex": "updatedAt", | ||
| "key": "updatedAt", | ||
| "align": "left", | ||
| "fixed": "", | ||
| "ellipsis": false, | ||
| "customRender": { | ||
| "type": "JSSlot", | ||
| "params": [ | ||
| "data" | ||
| ], | ||
| "value": [ | ||
| }, | ||
| { | ||
| "componentName": "FormText", | ||
| "id": "node_ocme9w0xkx1j", | ||
| "props": { | ||
| "propsData": { | ||
| "type": "JSExpression", | ||
| "value": "this.data" | ||
| }, | ||
| "type": "onlyText", | ||
| "textField": "", | ||
| "popoverField": "", | ||
| "text": "", | ||
| "textFieldResolve": "(text) => dayjs(text).format('YYYY-MM-DD HH:mm:ss')" | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "" | ||
| } | ||
| ], | ||
| "id": "node_ocme9w0xkx1i" | ||
| } | ||
| }, | ||
| { | ||
| "title": "操作", | ||
| "dataIndex": "action", | ||
| "align": "left", | ||
| "fixed": "", | ||
| "ellipsis": false, | ||
| "customRender": { | ||
| "type": "JSSlot", | ||
| "params": [ | ||
| "data" | ||
| ], | ||
| "value": [ | ||
| { | ||
| "componentName": "FormilyFormModalNew", | ||
| "id": "node_ocme9w0xkx1l", | ||
| "id": "node_ocmh948hp220", | ||
| "props": { | ||
| "label": "编辑", | ||
| "shouldInitialValue": true, | ||
| "label": "查看历史记录", | ||
| "shouldInitialValue": false, | ||
| "onlyRead": false, | ||
| "type": "default", | ||
| "modalWidth": "800px", | ||
| "type": "link", | ||
| "modalWidth": "1000px", | ||
| "modalTitle": "历史操作记录", | ||
| "tableData": { | ||
@@ -1259,2 +703,10 @@ "type": "JSExpression", | ||
| }, | ||
| "size": "small", | ||
| "hiddenCancel": true, | ||
| "okText": "关闭", | ||
| "cancelText": "取消", | ||
| "ghost": false, | ||
| "dangerBtn": false, | ||
| "broadcast": false, | ||
| "hidenWithNoPermission": false, | ||
| "openSlot": { | ||
@@ -1267,15 +719,171 @@ "type": "JSSlot", | ||
| { | ||
| "componentName": "FormilyFormNew", | ||
| "id": "node_ocme9w0xkx1n", | ||
| "componentName": "FormilyTable", | ||
| "id": "node_ocmh948hp222", | ||
| "props": { | ||
| "labelCol": 13, | ||
| "wrapperCol": 14, | ||
| "layout": "vertical", | ||
| "width": "100%", | ||
| "formUniqueKey": "form-k8hk5cd7", | ||
| "tableData": { | ||
| "eventName": "", | ||
| "bordered": true, | ||
| "dataSource": [], | ||
| "columns": [ | ||
| { | ||
| "title": "前筛", | ||
| "dataIndex": "desc", | ||
| "key": "desc", | ||
| "align": "center", | ||
| "ellipsis": false | ||
| }, | ||
| { | ||
| "title": "状态", | ||
| "dataIndex": "status", | ||
| "key": "status", | ||
| "align": "center", | ||
| "width": 100, | ||
| "ellipsis": false, | ||
| "customRender": { | ||
| "type": "JSSlot", | ||
| "params": [ | ||
| "data" | ||
| ], | ||
| "value": [ | ||
| { | ||
| "componentName": "FormText", | ||
| "id": "node_ocmh948hp224", | ||
| "props": { | ||
| "propsData": { | ||
| "type": "JSExpression", | ||
| "value": "this.data" | ||
| }, | ||
| "type": "onlyText", | ||
| "textField": "status", | ||
| "enumMap": "BooleanTypeEnum" | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "" | ||
| } | ||
| ], | ||
| "id": "node_ocmh948hp223" | ||
| } | ||
| }, | ||
| { | ||
| "title": "值", | ||
| "dataIndex": "data", | ||
| "key": "data", | ||
| "align": "center", | ||
| "width": 150, | ||
| "ellipsis": false | ||
| }, | ||
| { | ||
| "title": "更新时间", | ||
| "dataIndex": "timeUpdated", | ||
| "key": "timeUpdated", | ||
| "align": "center", | ||
| "width": 180, | ||
| "ellipsis": false, | ||
| "customRender": { | ||
| "type": "JSSlot", | ||
| "params": [ | ||
| "data" | ||
| ], | ||
| "value": [ | ||
| { | ||
| "componentName": "FormText", | ||
| "id": "node_ocmh948hp226", | ||
| "props": { | ||
| "propsData": { | ||
| "type": "JSExpression", | ||
| "value": "this.data" | ||
| }, | ||
| "type": "onlyText", | ||
| "textField": "timeUpdated", | ||
| "textFieldResolve": "(text) => text ? new Date(text).toLocaleString('zh-CN', { hour12: false }) : '-'" | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "" | ||
| } | ||
| ], | ||
| "id": "node_ocmh948hp225" | ||
| } | ||
| }, | ||
| { | ||
| "title": "渠道", | ||
| "dataIndex": "sdkType", | ||
| "key": "sdkType", | ||
| "align": "center", | ||
| "width": 150, | ||
| "ellipsis": false, | ||
| "customRender": { | ||
| "type": "JSSlot", | ||
| "params": [ | ||
| "data" | ||
| ], | ||
| "value": [ | ||
| { | ||
| "componentName": "FormText", | ||
| "id": "node_ocmh948hp228", | ||
| "props": { | ||
| "propsData": { | ||
| "type": "JSExpression", | ||
| "value": "this.data" | ||
| }, | ||
| "type": "onlyText", | ||
| "textField": "sdkType", | ||
| "enumMap": "SdkTypeEnum" | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "" | ||
| } | ||
| ], | ||
| "id": "node_ocmh948hp227" | ||
| } | ||
| }, | ||
| { | ||
| "title": "操作人", | ||
| "dataIndex": "adminUser", | ||
| "key": "adminUser", | ||
| "align": "center", | ||
| "width": 120, | ||
| "ellipsis": false | ||
| } | ||
| ], | ||
| "rowKey": "id", | ||
| "pagination": false, | ||
| "openRowSelection": false, | ||
| "requestOnMount": true, | ||
| "hiddenOnNoRequest": false, | ||
| "supportScroll": false, | ||
| "showHeader": true, | ||
| "size": "small", | ||
| "tableLayout": "", | ||
| "supportScrollX": 1000, | ||
| "recordData": { | ||
| "type": "JSExpression", | ||
| "value": "this.data" | ||
| }, | ||
| "showBtnSlot": { | ||
| "requestConfig": { | ||
| "url": "/loan/admin/operation/cashloan/precheck/log", | ||
| "method": "GET", | ||
| "dataFormat": "JSON", | ||
| "showRequestData": true, | ||
| "showResponseData": true, | ||
| "showGeneralResponseData": false, | ||
| "requestDataFunc": "async function(data, formInstance, util, requestConfig) {\n const { sdkType, operatorType, checkItem } = data.record || {};\n return { sdkType, operatorType, checkItem };\n}", | ||
| "responseDataFunc": "function(response, data) {\n const body = response.data?.body || [];\n const processedData = body.reduce((prev, item) => prev.concat([{\n ...item,\n ...item.config\n }]), []);\n return {\n status: response.data.status,\n body: {\n data: processedData,\n total: processedData.length\n }\n };\n}", | ||
| "headers": {}, | ||
| "headersList": [] | ||
| }, | ||
| "pageSizeOptions": "10,20,50,100", | ||
| "columnSetting": false, | ||
| "globalSelectAll": false, | ||
| "clearSelectedRowKeysOnRefresh": true, | ||
| "showSelectionSelectAll": true, | ||
| "columnControlFilterType": "none", | ||
| "openSlot": { | ||
| "type": "JSSlot", | ||
@@ -1285,10 +893,4 @@ "params": [ | ||
| ], | ||
| "id": "node_ocme9w0xkx1o" | ||
| }, | ||
| "hiddenFormButtonConfig": true, | ||
| "size": "middle", | ||
| "colon": false, | ||
| "clearLabelSpace": false, | ||
| "emitEventName": "", | ||
| "initFetch": false | ||
| "id": "node_ocmh948hp229" | ||
| } | ||
| }, | ||
@@ -1299,83 +901,8 @@ "hidden": false, | ||
| "condition": true, | ||
| "conditionGroup": "", | ||
| "children": [ | ||
| { | ||
| "componentName": "FormilyInput", | ||
| "id": "node_ocme9w0xkx1p", | ||
| "props": { | ||
| "showLabel": true, | ||
| "label": "设备名称", | ||
| "required": false, | ||
| "name": "deviceName", | ||
| "defaultValue": "", | ||
| "pattern": "", | ||
| "validator": "" | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "" | ||
| }, | ||
| { | ||
| "componentName": "FormTextarea", | ||
| "id": "node_ocme9w0xkx1q", | ||
| "props": { | ||
| "label": "描述", | ||
| "required": false, | ||
| "name": "desc", | ||
| "defaultValue": "", | ||
| "autoSize": false, | ||
| "showLabel": true, | ||
| "pattern": "", | ||
| "validator": "", | ||
| "minRows": 2, | ||
| "maxRows": 6 | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "" | ||
| }, | ||
| { | ||
| "componentName": "FormilyInput", | ||
| "id": "node_ocme9w0xkx1r", | ||
| "props": { | ||
| "showLabel": true, | ||
| "label": "系统", | ||
| "required": false, | ||
| "name": "system", | ||
| "defaultValue": "", | ||
| "pattern": "", | ||
| "validator": "" | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "" | ||
| } | ||
| ] | ||
| "conditionGroup": "" | ||
| } | ||
| ], | ||
| "id": "node_ocme9w0xkx1m" | ||
| "id": "node_ocmh948hp221" | ||
| }, | ||
| "size": "small", | ||
| "requestConfig": { | ||
| "url": "/appflux/devices/update", | ||
| "method": "POST", | ||
| "dataFormat": "JSON", | ||
| "showRequestData": false, | ||
| "showResponseData": false, | ||
| "showGeneralResponseData": false, | ||
| "headersList": [], | ||
| "headers": {}, | ||
| "requestDataFunc": "", | ||
| "responseDataFunc": "", | ||
| "responseGeneralDataFunc": "", | ||
| "showRequestCondition": false, | ||
| "requestConditionFunc": "" | ||
| }, | ||
| "broadcast": true | ||
| "uniqueId": "ys3wexytqim" | ||
| }, | ||
@@ -1387,45 +914,6 @@ "hidden": false, | ||
| "conditionGroup": "" | ||
| }, | ||
| { | ||
| "componentName": "FormilyButton", | ||
| "id": "node_ocme9w0xkx1s", | ||
| "props": { | ||
| "label": "删除", | ||
| "type": "primary", | ||
| "secondCheck": true, | ||
| "secondCheckText": "是否确认删除设备?", | ||
| "buttonType": "control", | ||
| "propsData": { | ||
| "type": "JSExpression", | ||
| "value": "this.data" | ||
| }, | ||
| "dangerBtn": true, | ||
| "size": "small", | ||
| "requestConfig": { | ||
| "url": "/appflux/devices/delete", | ||
| "method": "POST", | ||
| "dataFormat": "JSON", | ||
| "showRequestData": true, | ||
| "showResponseData": false, | ||
| "showGeneralResponseData": false, | ||
| "headersList": [], | ||
| "headers": {}, | ||
| "requestDataFunc": "function (params) {\n return {\n id: params.id\n }\n}", | ||
| "responseDataFunc": "", | ||
| "responseGeneralDataFunc": "", | ||
| "showRequestCondition": false, | ||
| "requestConditionFunc": "" | ||
| }, | ||
| "broadcast": true | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "" | ||
| } | ||
| ], | ||
| "id": "node_ocme9w0xkx1k" | ||
| }, | ||
| "width": 200 | ||
| "id": "node_ocmh948hp21p" | ||
| } | ||
| } | ||
@@ -1440,7 +928,6 @@ ], | ||
| "openRowSelection": false, | ||
| "requestOnMount": false, | ||
| "requestOnMount": true, | ||
| "hiddenOnNoRequest": false, | ||
| "supportScroll": false, | ||
| "showHeader": true, | ||
| "bordered": true, | ||
| "size": "default", | ||
@@ -1453,22 +940,287 @@ "tableLayout": "", | ||
| }, | ||
| "requestConfig": { | ||
| "url": "/appflux/devices/getList", | ||
| "method": "GET", | ||
| "dataFormat": "JSON", | ||
| "showRequestData": false, | ||
| "showResponseData": true, | ||
| "showGeneralResponseData": false, | ||
| "headersList": [], | ||
| "headers": {}, | ||
| "requestDataFunc": "", | ||
| "responseDataFunc": "function(response, data){\n // 这里写你的处理逻辑\n // response 就是 axios 的原始结构 { data: { status, body } }\n // data 是请求时传入的参数,包函了排序参数等\n return {\n status: response.data.status,\n body: {\n data: response.data.body.list,\n total: response.data.body.total\n }\n }\n}", | ||
| "responseGeneralDataFunc": "", | ||
| "showRequestCondition": false, | ||
| "requestConditionFunc": "" | ||
| }, | ||
| "showSelectionSelectAll": true, | ||
| "clearSelectedRowKeysOnRefresh": true, | ||
| "pageSizeOptions": "10,20,50,100", | ||
| "columnSetting": false, | ||
| "globalSelectAll": false | ||
| "globalSelectAll": false, | ||
| "clearSelectedRowKeysOnRefresh": true, | ||
| "showSelectionSelectAll": true, | ||
| "columnControlFilterType": "none", | ||
| "openSlot": { | ||
| "type": "JSSlot", | ||
| "params": [ | ||
| "data" | ||
| ], | ||
| "value": [ | ||
| { | ||
| "componentName": "FormilyFormModalNew", | ||
| "id": "node_ocmh948hp22e", | ||
| "props": { | ||
| "label": "新增前筛", | ||
| "shouldInitialValue": false, | ||
| "onlyRead": false, | ||
| "type": "primary", | ||
| "modalWidth": "600px", | ||
| "modalTitle": "新增前筛选择", | ||
| "tableData": { | ||
| "type": "JSExpression", | ||
| "value": "this.data" | ||
| }, | ||
| "size": "middle", | ||
| "customCondtion": "() => window.lcMicroAppProps?.hasUpdatePermission === true", | ||
| "hidenWithNoPermission": false, | ||
| "broadcast": true, | ||
| "emitEventName": "frontSearchTableRefresh", | ||
| "okText": "确定", | ||
| "cancelText": "取消", | ||
| "hiddenCancel": false, | ||
| "secondCheck": false, | ||
| "secondCheckText": "", | ||
| "ghost": false, | ||
| "dangerBtn": false, | ||
| "requestConfig": { | ||
| "url": "/loan/admin/operation/cashloan/precheck/create", | ||
| "method": "POST", | ||
| "dataFormat": "JSON", | ||
| "showRequestData": true, | ||
| "showResponseData": false, | ||
| "showGeneralResponseData": false, | ||
| "requestDataFunc": "async function(data, formInstance, util, requestConfig) {\n const { sdkType, checkItem, operatorType, data: dataValue, desc, status } = data || {};\n return {\n sdkType,\n checkItem,\n operatorType,\n data: dataValue || '',\n desc,\n status\n };\n}", | ||
| "headers": {}, | ||
| "headersList": [] | ||
| }, | ||
| "openSlot": { | ||
| "type": "JSSlot", | ||
| "params": [ | ||
| "data" | ||
| ], | ||
| "value": [ | ||
| { | ||
| "componentName": "FormilyFormNew", | ||
| "id": "node_ocmh948hp22n", | ||
| "props": { | ||
| "labelCol": 6, | ||
| "wrapperCol": 16, | ||
| "layout": "horizontal", | ||
| "width": "100%", | ||
| "tableData": { | ||
| "type": "JSExpression", | ||
| "value": "this.data" | ||
| }, | ||
| "hiddenFormButtonConfig": true, | ||
| "size": "middle", | ||
| "colon": true, | ||
| "clearLabelSpace": false, | ||
| "emitEventName": "", | ||
| "initFetch": false, | ||
| "broadcast": false | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "", | ||
| "children": [ | ||
| { | ||
| "componentName": "FormSelect", | ||
| "id": "node_ocmh948hp22o", | ||
| "props": { | ||
| "showLabel": true, | ||
| "label": "API渠道", | ||
| "required": true, | ||
| "message": "请选择API渠道", | ||
| "name": "sdkType", | ||
| "enumName": "SdkTypeEnum", | ||
| "mode": "combobox", | ||
| "showSearch": false, | ||
| "allowClear": false, | ||
| "placeholder": "请选择API渠道", | ||
| "width": "", | ||
| "defaultValue": "", | ||
| "pattern": "", | ||
| "validator": "", | ||
| "virtual": false, | ||
| "openTooltip": false, | ||
| "selectAll": false, | ||
| "autoClearSearchValue": true | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "" | ||
| }, | ||
| { | ||
| "componentName": "FormSelect", | ||
| "id": "node_ocmh948hp22p", | ||
| "props": { | ||
| "showLabel": true, | ||
| "label": "前筛条件", | ||
| "required": true, | ||
| "message": "请选择前筛条件", | ||
| "name": "checkItem", | ||
| "enumName": "CheckItemEnum", | ||
| "mode": "combobox", | ||
| "showSearch": false, | ||
| "allowClear": false, | ||
| "placeholder": "请选择前筛条件", | ||
| "width": "", | ||
| "defaultValue": "", | ||
| "pattern": "", | ||
| "validator": "", | ||
| "virtual": false, | ||
| "openTooltip": false, | ||
| "selectAll": false, | ||
| "autoClearSearchValue": true | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "" | ||
| }, | ||
| { | ||
| "componentName": "FormSelect", | ||
| "id": "node_ocmh948hp22q", | ||
| "props": { | ||
| "showLabel": true, | ||
| "label": "符号选择", | ||
| "required": true, | ||
| "message": "请选择符号", | ||
| "name": "operatorType", | ||
| "enumName": "OperatorTypeEnum", | ||
| "mode": "combobox", | ||
| "showSearch": false, | ||
| "allowClear": false, | ||
| "placeholder": "请选择符号", | ||
| "width": "", | ||
| "defaultValue": "", | ||
| "pattern": "", | ||
| "validator": "", | ||
| "virtual": false, | ||
| "openTooltip": false, | ||
| "selectAll": false, | ||
| "autoClearSearchValue": true | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "" | ||
| }, | ||
| { | ||
| "componentName": "FormilyInput", | ||
| "id": "node_ocmh948hp22r", | ||
| "props": { | ||
| "showLabel": true, | ||
| "label": "值", | ||
| "required": true, | ||
| "message": "请输入值", | ||
| "name": "data", | ||
| "placeholder": "请输入值", | ||
| "allowClear": true, | ||
| "width": "", | ||
| "defaultValue": "", | ||
| "pattern": "", | ||
| "validator": "", | ||
| "reactionsSetter": { | ||
| "dependencies": [ | ||
| { | ||
| "property": "value", | ||
| "type": "any", | ||
| "source": "operatorType", | ||
| "name": "operatorType" | ||
| } | ||
| ], | ||
| "fulfill": { | ||
| "run": "$effect(() => {\n const hiddenValues = ['NOT_BLANK', 'BLANK'];\n $self.visible = !hiddenValues.includes($deps.operatorType);\n}, [$deps.operatorType])", | ||
| "state": {} | ||
| } | ||
| } | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "" | ||
| }, | ||
| { | ||
| "componentName": "FormilyInput", | ||
| "id": "node_ocmh948hp22s", | ||
| "props": { | ||
| "showLabel": true, | ||
| "label": "前筛", | ||
| "required": false, | ||
| "name": "desc", | ||
| "disabled": true, | ||
| "placeholder": "自动生成", | ||
| "allowClear": false, | ||
| "width": "", | ||
| "defaultValue": "", | ||
| "pattern": "", | ||
| "validator": "" | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "" | ||
| }, | ||
| { | ||
| "componentName": "FormSelect", | ||
| "id": "node_ocmh948hp22t", | ||
| "props": { | ||
| "showLabel": true, | ||
| "label": "状态", | ||
| "required": false, | ||
| "name": "status", | ||
| "defaultValue": "TRUE", | ||
| "enumName": "BooleanTypeEnum", | ||
| "mode": "combobox", | ||
| "showSearch": false, | ||
| "allowClear": false, | ||
| "placeholder": "请选择状态", | ||
| "width": "", | ||
| "pattern": "", | ||
| "validator": "", | ||
| "virtual": false, | ||
| "openTooltip": false, | ||
| "selectAll": false, | ||
| "autoClearSearchValue": true | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "" | ||
| } | ||
| ] | ||
| } | ||
| ], | ||
| "id": "node_ocmh948hp22f" | ||
| }, | ||
| "uniqueId": "99wo2lb7vv9" | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "" | ||
| } | ||
| ], | ||
| "id": "node_ocmh948hp2y" | ||
| }, | ||
| "defaultPageSize": 10, | ||
| "refreshActionAfterSelected": false, | ||
| "openExpandedRowRenderSlot": false, | ||
| "previewDataSource": [ | ||
| { | ||
| "id": 1 | ||
| }, | ||
| { | ||
| "id": 2 | ||
| }, | ||
| { | ||
| "id": 3 | ||
| } | ||
| ], | ||
| "rowExpandableFunc": "(record) => {\n return record.id === 1;\n}" | ||
| }, | ||
@@ -1475,0 +1227,0 @@ "hidden": false, |
+7
-2
@@ -11,3 +11,3 @@ "use strict"; | ||
| const app = (0, express_1.default)(); | ||
| app.use(express_1.default.json()); | ||
| app.use(express_1.default.json({ limit: '10mb' })); | ||
| app.use('/assets', assets_1.default); | ||
@@ -18,6 +18,11 @@ app.use('/healthCheck', (req, res) => { | ||
| app.use(mcp_1.default); | ||
| app.listen(config_1.config.port, () => { | ||
| const server = app.listen(config_1.config.port, () => { | ||
| console.log(`服务启动成功,端口:${config_1.config.port}`); | ||
| console.log(`MCP Server URL: ${(0, config_1.getServerUrl)()}${config_1.config.endpoint}`); | ||
| console.log(`Assets Server URL: ${(0, config_1.getServerUrl)()}/assets`); | ||
| console.log(`Session Timeout: ${config_1.config.sessionTimeout}ms (${config_1.config.sessionTimeout / 60000}分钟)`); | ||
| }); | ||
| // 设置服务器级别的超时时间 | ||
| server.timeout = config_1.config.sessionTimeout; // 请求超时时间 | ||
| server.keepAliveTimeout = config_1.config.sessionTimeout; // Keep-Alive 超时时间 | ||
| server.headersTimeout = config_1.config.sessionTimeout + 1000; // 头部超时时间(建议比 keepAliveTimeout 大一点) |
@@ -15,2 +15,3 @@ "use strict"; | ||
| const zod_1 = require("zod"); | ||
| const util_1 = require("../utils/util"); | ||
| const registerAnalyzeOldPageTool = (server) => { | ||
@@ -25,57 +26,37 @@ server.registerTool("analyze-old-page-structure", { | ||
| }, | ||
| outputSchema: { | ||
| analyzeDone: zod_1.z.boolean().describe('页面分析是否完成'), | ||
| needExecuteTask: zod_1.z.string().optional().describe('这一步之后需要执行的任务'), | ||
| annotations: { | ||
| streamable: true | ||
| } | ||
| }, (input) => __awaiter(void 0, void 0, void 0, function* () { | ||
| const result = ` | ||
| 需要前置检查: | ||
| - 页面中是否有枚举:${input.hadEnum} | ||
| - 页面中是否有全局表单:${input.hadOverAllForm} | ||
| - 页面中是否有表格:${input.hadTable} | ||
| - 弹窗中是否有自定义按钮:${input.hadModalButtonCustom} | ||
| 需要前置检查: | ||
| - 页面中是否有枚举: ${input.hadEnum} | ||
| - 页面中是否有全局表单: ${input.hadOverAllForm} | ||
| - 页面中是否有表格: ${input.hadTable} | ||
| - 弹窗中是否有自定义按钮: ${input.hadModalButtonCustom} | ||
| ## 组件分类说明: | ||
| 对于 form 跟 table 之外的组件,都归类于 button 跟 modalButton: | ||
| - 新增、新建、编辑、查看、历史记录等操作 → 查看是跳转还是弹窗 | ||
| - 弹窗操作使用 FormilyFormModalNew 组件的 props.openSlot 放置子元素 | ||
| - 删除等操作使用 FormilyButton 组件,在 function 属性中实现自定义逻辑 | ||
| ## 分析任务列表(共 ${analyzeTask_1.analyzeTask.length} 个任务): | ||
| ${analyzeTask_1.analyzeTask.map((item, index) => `${index + 1}. ${item.title} | ||
| - ${item.description} | ||
| `).join('\n')} | ||
| 对于form跟table之外的组件,都归类于button跟modalButton,比如: | ||
| - 新增、新建、编辑、查看、历史记录等操作,需要查看逻辑是跳转还是弹窗,如果是弹窗要在FormilyFormModalNew的props.openSlot中放子元素 | ||
| - 删除等操作,需要在自定义逻辑中实现 { | ||
| "componentName": "FormilyButton", | ||
| "id": "node_ocmf2aerzid", | ||
| "props": { | ||
| "label": "按钮", | ||
| "type": "default", | ||
| "size": "small", | ||
| "secondCheck": false, | ||
| "secondCheckText": "是否确认操作?", | ||
| "buttonType": "function", | ||
| "propsData": { | ||
| "type": "JSExpression", | ||
| "value": "this.data" | ||
| }, | ||
| "function": "\n// 自定义函数,必须是箭头函数\n/*\n formInstance: 表单实例(必须在form内部才能获取到)\n window: window 对象\n broadcast: 广播函数\n data: 所有参数,\n util: 扩展参数\n - message: 对应antd的message\n - actionObserver: 发布订阅实例可以用来自定义逻辑通知\n - modal: 对应antd的Modal\n - setButtonLoading: 设置按钮loading状态\n*/\n({formInstance, window, data, broadcast, util}) => void\n\n* formInstance 是 formily 表单的实例,支持的API:https://core.formilyjs.org/zh-CN/api/models/form\n\n// 示例1 通过formInstance获取/设置表单数据,然后通过message提示\n({ formInstance, window, data, broadcast, util }) => {\n formInstance.submit();\n formInstance.setFieldState('status', (state) => {\n state.visible = true;\n state.title = 'new title';\n state.description = 'new description';\n });\n util.message.success('提交成功');\n}\n\n// 示例2 表单提交前二次确认\n({data}) =>{\n return {\n visible: !lcGetGlobalVariable('iSenableFlag'),\n message: '是否确认提交?',\n }\n}\n\n//示例三 表单列表中添加表单项并回调复制\n// formInstance当前表单\n// addForm 添加表单项\n// newForm 新添加的表单实例\n// getNowFormIndex 获取当前表单索引\n({data,formInstance})=>{\n const {addForm, getNowFormIndex} = data.extend;\n const nowFormIdx = getNowFormIndex();\n addForm({\n newIndex: nowFormIdx + 1,\n callBack: (newForm)=>{\n newForm.setValues(formInstance.values)\n }\n });\n}\n" | ||
| }, | ||
| "hidden": false, | ||
| "title": "", | ||
| "isLocked": false, | ||
| "condition": true, | ||
| "conditionGroup": "" | ||
| } | ||
| 然后继续分析当前页面,一步步分析${analyzeTask_1.analyzeTask.map(item => `\n | ||
| - ${item.title} - ${item.description} | ||
| - 示例:${JSON.stringify(item.expectResult, null, 2)}`).join("\n")} | ||
| 分析出来的结果参考按照${JSON.stringify(require('../constant/demo.json'))}的格式来输出json注入到上下文中 | ||
| `; | ||
| 请按照以上任务顺序逐步分析页面结构。 | ||
| `; | ||
| const zipResult = yield (0, util_1.zipContextByAgent)(result, '分析源码页面结构任务', { | ||
| extraPrompt: ` | ||
| **Notes** | ||
| - Retain key examples such as dependencies, JSSlot, JsonConfig, dayjs formatting, etc. | ||
| ` | ||
| }); | ||
| return { | ||
| content: [{ | ||
| type: "text", text: ` | ||
| 成功分析页面结构:${result} | ||
| ` | ||
| type: "text", | ||
| text: `页面结构需要梳理的内容: ${zipResult}` | ||
| }], | ||
| structuredContent: { | ||
| analyzeDone: true, | ||
| // needExecuteTask: result | ||
| } | ||
| }; | ||
@@ -82,0 +63,0 @@ })); |
@@ -17,32 +17,11 @@ "use strict"; | ||
| const zod_1 = __importDefault(require("zod")); | ||
| const util_1 = require("../utils/util"); | ||
| const registerGenerateLowcodeSchemaTool = (server) => { | ||
| server.registerTool("generate-lowcode-schema", { | ||
| description: "生成低代码schema任务", | ||
| description: "生成低代码SchemaJSON任务", | ||
| inputSchema: { | ||
| pageRequests: zod_1.default.array(zod_1.default.object({ | ||
| url: zod_1.default.object({ | ||
| url: zod_1.default.string().describe("页面请求地址"), | ||
| method: zod_1.default.string().describe("页面请求方法"), | ||
| params: zod_1.default.object({ | ||
| page: zod_1.default.number().describe("页面"), | ||
| pageSize: zod_1.default.number().describe("每页条数"), | ||
| }).describe("页面请求参数"), | ||
| }).describe("url配置"), | ||
| })).describe("页面请求配置列表,包含了这个页面中所有的请求配置"), | ||
| pageSchema: zod_1.default.string().describe("历史页面的 schema 对象"), | ||
| lowCodeAssetsDone: zod_1.default.boolean().describe('低码物料映射是否完成,完成才执行此任务'), | ||
| analyzeDone: zod_1.default.boolean().describe('页面分析是否完成,完成才执行此任务'), | ||
| schemaExample: zod_1.default.string().describe('低码页面示例的schema,用来参考示例JSON的格式'), | ||
| assetsDesc: zod_1.default.string().describe('低码物料描述'), | ||
| enumsConfig: zod_1.default.string().describe('枚举配置列表,包含了这个页面中所有的枚举配置'), | ||
| pageButtonsPermission: zod_1.default.string().describe('页面按钮权限点列表,包含了这个页面中所有的按钮权限点'), | ||
| pageOperations: zod_1.default.string().describe('页面操作配置列表,包含了这个页面中所有的操作,比如按钮、弹窗按钮等'), | ||
| pageFormItems: zod_1.default.string().describe('页面表单项配置列表,包含了这个页面中所有的表单项配置'), | ||
| pageTableColumns: zod_1.default.string().describe('页面表格列配置列表,包含了这个页面中所有的表格列配置'), | ||
| pageConditionVariables: zod_1.default.string().describe('页面条件分支变量列表,包含了这个页面中所有的条件分支变量以及对应的展示逻辑'), | ||
| pageConditionVariables: zod_1.default.string().describe("页面条件分支变量列表,包含了这个页面中所有的条件分支变量以及对应的展示逻辑"), | ||
| i18nPageTexts: zod_1.default.string().describe('页面中的所有文案'), | ||
| }, | ||
| outputSchema: { | ||
| generateLowcodeSchemaDone: zod_1.default.boolean().describe("生成低代码schema是否完成"), | ||
| needExecuteTask: zod_1.default.string().optional().describe('这一步之后需要执行的任务'), | ||
| }, | ||
| annotations: { | ||
@@ -55,67 +34,57 @@ streamable: true | ||
| 要求: | ||
| 生成的低代码schema要严格的遵循官方示例的格式 | ||
| 生成的低代码schema要严格的遵循官方示例的格式 | ||
| 低代码的使用示例: | ||
| ${input.schemaExample} | ||
| fewshotSchema(官方示例): | ||
| ${(0, util_1.getFewshotExample)()} | ||
| 历史页面的 schema 对象: | ||
| ${input.pageSchema} | ||
| 历史页面的 schema 对象: | ||
| ${input.pageSchema} | ||
| 页面的所有文案: | ||
| ${input.i18nPageTexts} | ||
| 备注:如果文案中存在如(pre)等处理,提取真正的国际化字段使用,并使用 PreConfig 组件,如: | ||
| { | ||
| "componentName": "PreConfig", | ||
| "props": { | ||
| "configName": "翻译前缀配置", | ||
| "preJsonConfig": { | ||
| "lcUniquePre": "lowCodeTranslate.uniqueName" | ||
| } | ||
| } | ||
| } | ||
| 页面请求配置列表,包含了这个页面中所有的请求配置: | ||
| ${input.pageRequests} | ||
| 页面条件分支变量列表,包含了这个页面中所有的条件分支变量以及对应的展示逻辑: | ||
| ${input.pageConditionVariables} | ||
| 变量统一从 lcMicroAppProps 中获取 | ||
| 页面表单项配置列表,包含了这个页面中所有的表单项配置: | ||
| ${input.pageFormItems} | ||
| 页面表格列配置列表,包含了这个页面中所有的表格列配置,生成对应按钮或者弹窗,需要查看低码物料的描述来生成props,不要自己捏造: | ||
| ${input.pageTableColumns} | ||
| 页面操作配置列表,包含了这个页面中所有的操作配置: | ||
| ${input.pageOperations} | ||
| 页面按钮权限点列表,包含了这个页面中所有的按钮及权限点,: | ||
| ${input.pageButtonsPermission} | ||
| 枚举配置列表,包含了这个页面中所有的枚举配置: | ||
| ${input.enumsConfig} | ||
| 页面条件分支变量列表,包含了这个页面中所有的条件分支变量以及对应的展示逻辑: | ||
| ${input.pageConditionVariables} | ||
| 变量统一从 lcMicroAppProps 中获取 | ||
| 根据条件分支变量列表来生成页面,一般有以下几种情况: | ||
| - 按钮:schema中的组件props("customCondtion": "() => lcMicroAppProps.isXXX === 1") | ||
| - 弹窗:schema中的组件props("customCondtion": "() => lcMicroAppProps.isXXX === 1") | ||
| - 表格列:schema中的组件props("columnControlFilterRules": "({columns}) => {\n return columns.filter((column) => column.dataIndex === lcMicroAppProps.XXX);\n}\n") | ||
| - 表单项:每一个表单项都支持联动配置,配置规则是修改 props.reactionsSetter: | ||
| "reactionsSetter": { | ||
| "dependencies": [ | ||
| { | ||
| "property": "value", | ||
| "type": "any" | ||
| 根据条件分支变量列表来生成页面,一般有以下几种情况: | ||
| - 按钮:schema中的组件props("customCondtion": "() => lcMicroAppProps.isXXX === 1") | ||
| - 弹窗:schema中的组件props("customCondtion": "() => lcMicroAppProps.isXXX === 1") | ||
| - 表格列:schema中的组件props("columnControlFilterRules": "({columns}) => {\n return columns.filter((column) => column.dataIndex === lcMicroAppProps.XXX);\n}\n") | ||
| - 表单项:每一个表单项都支持联动配置,配置规则是修改 props.reactionsSetter: | ||
| "reactionsSetter": { | ||
| "dependencies": [ | ||
| { | ||
| "property": "value", | ||
| "type": "any" | ||
| } | ||
| ], | ||
| "fulfill": { | ||
| "run": "", | ||
| "state": { | ||
| "visible": "{{window.lcMicroAppProps.isXXX === true}}" | ||
| } | ||
| } | ||
| ], | ||
| "fulfill": { | ||
| "run": "", | ||
| "state": { | ||
| "visible": "{{window.lcMicroAppProps.isXXX === true}}" | ||
| } | ||
| } | ||
| }, | ||
| - 其他具体要看条件分支变量列表中的内容来生成,但是变量都从 lcMicroAppProps 中获取 | ||
| }, | ||
| - 其他具体要看条件分支变量列表中的内容来生成,但是变量都从 lcMicroAppProps 中获取 | ||
| - 注意:如果条件分支是读取的权限点,那就换成权限点配置,不要使用条件分支变量列表中的变量 | ||
| 低码物料描述: | ||
| ${input.assetsDesc} | ||
| 其他参考信息可以从上下文中读取; | ||
| `; | ||
| (0, util_1.writeLogFile)('生成低代码最终上下文提示词', result); | ||
| return { | ||
| content: [{ | ||
| type: "text", | ||
| text: ` | ||
| ${result} | ||
| `, | ||
| text: result, | ||
| }], | ||
| structuredContent: { | ||
| generateLowcodeSchemaDone: true, | ||
| // needExecuteTask: result | ||
| } | ||
| }; | ||
@@ -122,0 +91,0 @@ })); |
@@ -16,3 +16,3 @@ "use strict"; | ||
| server.registerTool("get-trans-lowcode-task", { | ||
| description: "生成低代码schema任务", | ||
| description: "生成低代码schema任务列表", | ||
| }, () => __awaiter(void 0, void 0, void 0, function* () { | ||
@@ -29,24 +29,27 @@ return ({ | ||
| exports.registerGetTransLowcodeTaskTool = registerGetTransLowcodeTaskTool; | ||
| exports.taskList = [ | ||
| `你是一个资深的低代码工程师,有着丰富的把存量的代码页面转换成低代码页面的经验,现在需要你把当前任务是要把存量的代码页面转换成低代码页面,为了便于你理解,调用的工具结果都要保存在上下文中供你随时查看,结果只能是一个json,不要其他任何的输出,不要有任何的发散,工具返回的needExecuteTask是下一步要执行的任务`, | ||
| '严格按照以下步骤来执行:', | ||
| `1.分析当前页面中的所有操作,比如表单中的操作按钮、表格中的操作列等,分析功能是按钮还是弹窗,示例:${constant_1.pageOperationsExample},一定要深入分析弹窗内容,注入key为 pageOperations 到上下文中`, | ||
| '2.分析页面中的所有用到的请求,找到真实定义的地方读取path,不能忽略公共前缀;表格默认参数有 pageSize跟pageNo,如果需要使用requestConditionFunc就开启showRequestCondition,需要使用requestDataFunc就开启showRequestData,需要使用responseDataFunc就开启showResponseData,需要使用responseGeneralDataFunc就开启showGeneralResponseData,注入上下文中,key为 pageRequests', | ||
| '3.分析页面中的所有表单项及表单配置,注入上下文中,注入key为 pageFormItems', | ||
| '4.分析页面中的所有表格列,如果是hover提示类型,使用FormText组件,并设置hover提示内容,如果是按钮类型就使用按钮|弹窗按钮组件,注入上下文中,注入key为 pageTableColumns', | ||
| '5.分析存量页面中的所有枚举配置,注入上下文中,key为 enumsConfig', | ||
| `6.分析表单中的默认值使用情况,默认值设置统一使用props中的"reactionsSetter"中的initialValue: ${constant_1.formItemsDetailExample}`, | ||
| const taskDetailList = [ | ||
| `分析存量页面中的所有操作,比如表单中的操作按钮、表格中的操作列等,分析功能是按钮还是弹窗,示例:${constant_1.pageOperationsExample},一定要深入分析弹窗内容,注入key为 pageOperations 到上下文中`, | ||
| '分析存量页面中的所有用到的请求,找到真实定义的地方读取path,不能忽略公共前缀;表格分页参数固定是 pageSize跟pageNo,如果需要使用requestConditionFunc就开启showRequestCondition,需要使用requestDataFunc就开启showRequestData,需要使用responseDataFunc就开启showResponseData,需要使用responseGeneralDataFunc就开启showGeneralResponseData,注入上下文中,key为 pageRequests', | ||
| '分析存量页面中的所有表单项及表单配置,需要注意表单项的校验规则,注入上下文中,注入key为 pageFormItems', | ||
| `${constant_1.tableCellPrompt}`, | ||
| '分析存量页面中的所有枚举配置,注入上下文中,key为 enumsConfig', | ||
| '分析页面中的所有文案,如果存在如(pre)等处理,提取真正的国际化字段,并且本次生成必须要使用 PreConfig 组件,注入上下文中,key为 i18nPageTexts', | ||
| `分析表单中的默认值使用情况,默认值设置统一使用props中的"reactionsSetter"中的initialValue: ${constant_1.formItemsDetailExample}`, | ||
| `- 如果存量页面有时间戳格式化逻辑,就使用 FormText 组件,并设置时区自动转换 | ||
| - "openUTCTranslate": true, | ||
| - "openUTCTranslateFormat": "YYYY-MM-DD HH:mm:ss",`, | ||
| '7.分析页面中的所有按钮权限点,只提取权限点,注入key为 pageButtonsPermission', | ||
| `8.调用【映射低码物料工具】获取低代码物料描述,调用【页面分析工具】工具来获取需要分析的内容`, | ||
| '9.生成pageSchema,注入当前上下文中,注入key为pageSchema', | ||
| '10.分析页面中的所有条件分支变量以及对应的展示逻辑(如果分支变量是读取权限点就忽略这个变量,在权限点处配置),注入上下文中,注入key为 pageConditionVariables', | ||
| '11.调用【生成低代码schema工具】来生成 lowCodeSchema', | ||
| '12.使用【低代码jsonSchema检查工具】来确保 lowCodeSchema 格式的正确性', | ||
| '13.写入lowCodeSchema到文件中,注意json的内容是 {component: "page"}这个维度的,如果是数组就抽离内部的页面内容 ', | ||
| '14.调用【解析schema工具】检查lowcode.json文件内容', | ||
| '15.执行任务:生成迁移报告', | ||
| '结束任务', | ||
| `${constant_1.enumPrompt}`, | ||
| '分析存量页面中的所有条件分支变量以及对应的展示逻辑(如果分支变量是读取权限点就忽略这个变量,在权限点处配置),注入上下文中,注入key为 pageConditionVariables', | ||
| '调用【低代码组件名称列表工具】获取低代码组件名称列表然后分析当前页面中用到的组件名称,调用【获取低码物料详情工具】获取低代码组件详情,调用【页面分析工具】工具来获取需要分析的内容', | ||
| `调用【获取官方示例 fewshotSchema】`, | ||
| '调用【生成低代码SchemaJSON任务】来获取任务步骤并执行,生成lowCodeSchema', | ||
| '使用【低代码jsonSchema检查工具】获取检查任务来确保 lowCodeSchema 格式的正确性', | ||
| '调用【解析schema工具】检查lowcod.json文件内容', | ||
| ]; | ||
| exports.taskList = [ | ||
| `你是一个资深的低代码工程师,有着丰富的把存量的代码页面转换成低代码页面的经验,现在需要你把当前任务是要把存量的代码页面转换成低代码页面,结果写入当前页面同目录的lowcode.json中,为了便于你理解,调用的工具结果都要保存在上下文中供你随时查看,结果只能是一个json,不要其他任何的输出,不要有任何的发散,多Tab的页面每个都要生成`, | ||
| '严格按照以下步骤来执行:', | ||
| ...taskDetailList.map((item, index) => `${index + 1}. ${item}`), | ||
| '清空当前所有的上下文', | ||
| '然后获取【生成迁移报告所需的任务步骤列表】按步骤执行生成迁移报告,结束任务', | ||
| ]; |
@@ -15,52 +15,77 @@ "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.registerListLowcodeAssetsTool = void 0; | ||
| exports.registerGetLowcodeAssetsDetailTool = exports.registerListLowcodeAssetsTool = void 0; | ||
| const path_1 = __importDefault(require("path")); | ||
| const fs_1 = __importDefault(require("fs")); | ||
| const zod_1 = __importDefault(require("zod")); | ||
| const initAssetsDesc = ` | ||
| 低码物料列表: | ||
| [ | ||
| 'BusinessSlot', 'FlexContainer', | ||
| 'HtmlSlot', 'RequestContainer', | ||
| 'FormilyTag', 'FormilyTable', | ||
| 'TableMenu', 'TableSearchForm', | ||
| 'TableSwitch', 'FormilyAutoComplete', | ||
| 'FormilyButton', 'FormilyFormModalNew', | ||
| 'FormCascader', 'FormCheckbox', | ||
| 'FormilyContainer', 'FormilyDatePicker', | ||
| 'FormilyInput', 'FormilyInputNumber', | ||
| 'FormRadio', 'FormRangePicker', | ||
| 'FormSelect', 'FormilyFormSpace', | ||
| 'FormilySwitch', 'FormTextarea', | ||
| 'FormTreeSelect', 'FormilyUpload', | ||
| 'FormilyFormNew' | ||
| ] | ||
| `; | ||
| const util_1 = require("../utils/util"); | ||
| const registerListLowcodeAssetsTool = (server) => { | ||
| server.registerTool("list-lowcode-assets", { | ||
| description: "映射低码物料工具", | ||
| outputSchema: { | ||
| lowCodeAssetsDone: zod_1.default.boolean().describe('低码物料映射是否完成'), | ||
| assetsDesc: zod_1.default.string().optional().describe('低码物料描述'), | ||
| } | ||
| description: "低代码组件名称列表工具", | ||
| }, () => __awaiter(void 0, void 0, void 0, function* () { | ||
| const assetsPath = path_1.default.join(__dirname, '../constant/assetsDescription.json'); | ||
| let assetsDesc; | ||
| let componentsNameList = []; | ||
| if (fs_1.default.existsSync(assetsPath)) { | ||
| const fileContent = fs_1.default.readFileSync(assetsPath, 'utf-8'); | ||
| componentsNameList = JSON.parse(fileContent).map((item) => item.componentName); | ||
| } | ||
| return { | ||
| content: [{ | ||
| type: "text", text: `成功获取低码物料描述:${componentsNameList.join(',')}` | ||
| }], | ||
| }; | ||
| })); | ||
| }; | ||
| exports.registerListLowcodeAssetsTool = registerListLowcodeAssetsTool; | ||
| const registerGetLowcodeAssetsDetailTool = (server) => { | ||
| server.registerTool("get-lowcode-assets-detail", { | ||
| description: "获取低码物料详情工具", | ||
| inputSchema: { | ||
| componentsName: zod_1.default.string().describe("根据源码映射后的低代码组件名称,多个组件名称用逗号分隔,必须使用低代码组件名称列表中的物料名称"), | ||
| }, | ||
| annotations: { | ||
| streamable: true | ||
| } | ||
| }, (input) => __awaiter(void 0, void 0, void 0, function* () { | ||
| const { componentsName } = input; | ||
| const componentsNames = componentsName.split(','); | ||
| const assetsPath = path_1.default.join(__dirname, '../constant/assetsDescription.json'); | ||
| let assetsDesc = []; | ||
| /** 映射后的低代码组件描述列表 */ | ||
| const assetsDescList = []; | ||
| if (fs_1.default.existsSync(assetsPath)) { | ||
| const fileContent = fs_1.default.readFileSync(assetsPath, 'utf-8'); | ||
| assetsDesc = JSON.parse(fileContent); | ||
| componentsNames.forEach(name => { | ||
| const assetDesc = assetsDesc.find((item) => item.componentName === name); | ||
| if (assetDesc) { | ||
| assetsDescList.push(assetDesc); | ||
| } | ||
| else { | ||
| assetsDescList.push({ | ||
| componentName: name, | ||
| usage: '这个物料不存在,请仔细检查物料名称是否正确', | ||
| }); | ||
| } | ||
| }); | ||
| } | ||
| const zipResult = yield (0, util_1.zipContextByAgent)(JSON.stringify(assetsDescList), '获取低码物料描述详情', { | ||
| extraPrompt: ` | ||
| **Notes** | ||
| - Do not compress the semantics of the content; retain all information and avoid summaries, keep the key information like descProps, snippets, etc. | ||
| `, | ||
| openZip: false | ||
| }); | ||
| return { | ||
| content: [{ | ||
| type: "text", text: `成功获取低码物料描述:${assetsDesc ? JSON.stringify(assetsDesc) : initAssetsDesc}` | ||
| type: "text", text: ` | ||
| 当前可用的低代码物料列表为: | ||
| ${componentsNames.join(',')} | ||
| 不要使用物料列表之外的物料名称,一定要在当前可用的物料列表中存在 | ||
| ${JSON.stringify(assetsDescList)} | ||
| ` | ||
| }], | ||
| structuredContent: { | ||
| lowCodeAssetsDone: true, | ||
| // assetsDesc: assetsDesc ? JSON.stringify(assetsDesc) : initAssetsDesc | ||
| } | ||
| }; | ||
| })); | ||
| }; | ||
| exports.registerListLowcodeAssetsTool = registerListLowcodeAssetsTool; | ||
| exports.registerGetLowcodeAssetsDetailTool = registerGetLowcodeAssetsDetailTool; |
@@ -16,11 +16,12 @@ "use strict"; | ||
| exports.registerLowcodeExampleTool = void 0; | ||
| const util_1 = require("../utils/util"); | ||
| const zod_1 = __importDefault(require("zod")); | ||
| const registerLowcodeExampleTool = (server) => { | ||
| server.registerTool("get-lowcode-example", { | ||
| description: "获取低码页面示例的schema", | ||
| description: "获取官方示例 fewshotSchema", | ||
| inputSchema: { | ||
| componentsName: zod_1.default.string().describe("映射后的组件名称,多个组件名称用逗号分隔,需要列出所有的使用到的组件名称"), | ||
| }, | ||
| outputSchema: { | ||
| schemaExample: zod_1.default.string().optional().describe("低码页面示例的schema,聚合了多个schema示例,每一个schema示例都是一个完整的页面,低代码的schema是一个Object"), | ||
| annotations: { | ||
| streamable: true | ||
| } | ||
@@ -32,4 +33,13 @@ }, (input) => __awaiter(void 0, void 0, void 0, function* () { | ||
| method: 'POST', | ||
| headers: { | ||
| 'Content-Type': 'application/json' | ||
| }, | ||
| body: JSON.stringify({ | ||
| "pageSize": 3, | ||
| "statusAndWhere": [ | ||
| "LOWER(status) = :status", | ||
| { | ||
| "status": 1 | ||
| } | ||
| ], | ||
| "pageSize": 10, | ||
| "page": 1, | ||
@@ -46,24 +56,87 @@ "andWhereParams": [ | ||
| { | ||
| "status": "1" | ||
| "status": 1 | ||
| } | ||
| ] | ||
| ] | ||
| ], | ||
| "componentsNames": componentsNames | ||
| }) | ||
| }).then(res => res.json()); | ||
| const schemas = res.data.rows.map((item) => { | ||
| const willUseSchemas = res.data.rows.reverse().slice(0, 3); | ||
| const schemas = willUseSchemas.map((item) => { | ||
| try { | ||
| const jsonSchema = JSON.parse(item.scheme); | ||
| return jsonSchema.projectSchema.componentsTree[0]; | ||
| if (jsonSchema.projectSchema) { | ||
| const treeSchema = jsonSchema.projectSchema.componentsTree[0]; | ||
| treeSchema.lowCodePageId = item.pageId; | ||
| treeSchema.source = res.data.source || 'none'; | ||
| return treeSchema; | ||
| } | ||
| else { | ||
| jsonSchema.lowCodePageId = item.pageId; | ||
| jsonSchema.source = res.data.source || 'none'; | ||
| return jsonSchema; | ||
| } | ||
| } | ||
| catch (e) { | ||
| return null; | ||
| item.lowCodePageId = '0000'; | ||
| item.source = 'none'; | ||
| return item; | ||
| } | ||
| }).filter(Boolean); | ||
| // const zipResult = await zipContextByAgent(` | ||
| // we have ${schemas.length} data, they are: | ||
| // ${schemas.map((item: any, index: number) => | ||
| // `the ${index + 1} data: ${JSON.stringify(item)}` | ||
| // ).join('\n')} | ||
| // we use the following components to build the page: | ||
| // ${componentsName}`, '获取 fewshow 样例', { | ||
| // extraPrompt: ` | ||
| // **Task**: Merge multiple low-code schema examples into ONE complete reference example while maximizing compression. | ||
| // **Compression Rules** (Priority Order): | ||
| // 1. **Merge Strategy**: | ||
| // - Merge all ${schemas.length} examples into ONE comprehensive example | ||
| // - Choose the example with the MOST complete functionality as the base | ||
| // - Supplement missing components/props from other examples into the base | ||
| // - If components differ only in props values, merge to include ALL possible props | ||
| // 2. **Format Compression** (Aggressive): | ||
| // - Remove ALL whitespace: newlines, extra spaces, indentation | ||
| // - Remove ALL comments: Chinese/English comments, inline comments | ||
| // - Remove ALL debugging code: console.log, console.error, etc. | ||
| // - Minify JavaScript code in strings (reactionsSetter.fulfill.run, validators, etc.) | ||
| // - Keep code logic INTACT - only compress format, not functionality | ||
| // 3. **Deduplication**: | ||
| // - Remove duplicate components with IDENTICAL structure and props | ||
| // - Keep components if they differ in ANY meaningful way (different props, children, position) | ||
| // - For similar components, keep the one with MORE complete props/configuration | ||
| // 4. **Semantic Preservation**: | ||
| // - Keep ALL unique componentName types used across examples | ||
| // - Keep ALL unique prop configurations | ||
| // - Keep ALL business logic in functions (validators, requestConfig, etc.) | ||
| // - Preserve complete component hierarchy and nesting structure | ||
| // 5. **same component Selection**: | ||
| // - If there are multiple same components, select the newest one | ||
| // - example: FormilyForm and FormilyFormNew, select the FormilyFormNew, ButtonModal and FormilyButtonModalNew, select the FormilyButtonModalNew | ||
| // **Output Requirements**: | ||
| // - Return ONLY a valid JSON array: [{...}] | ||
| // - Single line, no formatting, maximum compression | ||
| // - Must be parseable by JSON.parse() | ||
| // - No explanations, no markdown, ONLY the JSON | ||
| // **Example Input**: | ||
| // [ | ||
| // {componentName:'FormilyForm', children:[{componentName:'FormilyInput', label:'用户'}]}, | ||
| // {componentName:'FormilyForm', children:[{componentName:'FormilyInput', label:'用户', required:true}]}, | ||
| // {componentName:'FormilyTable', columns:[]} | ||
| // ] | ||
| // **Expected Output**: | ||
| // [{componentName:'FormilyForm',children:[{componentName:'FormilyInput',label:'用户',required:true}]},{componentName:'FormilyTable',columns:[]}] | ||
| // **Critical**: The output must show the FULL CAPABILITY of all components used. If example1 shows basic usage and example2 shows advanced usage, include the advanced version. | ||
| // `, | ||
| // openZip: false | ||
| // }); | ||
| (0, util_1.writeLogFile)('获取官方示例-fewshotSchema', JSON.stringify(schemas, null, 2)); | ||
| (0, util_1.setFewshotExample)(JSON.stringify(schemas)); | ||
| return { | ||
| content: [{ | ||
| type: "text", text: `获取成功:${JSON.stringify(schemas)}` | ||
| type: "text", text: `官方示例 fewshotSchema 获取成功` | ||
| }], | ||
| structuredContent: { | ||
| // schemaExample: JSON.stringify(schemas) | ||
| } | ||
| }; | ||
@@ -70,0 +143,0 @@ })); |
@@ -18,2 +18,7 @@ "use strict"; | ||
| const fs_1 = __importDefault(require("fs")); | ||
| const table_search_1 = require("./optimization/table-search"); | ||
| const modal_add_1 = require("./optimization/modal-add"); | ||
| const permission_1 = require("./optimization/permission"); | ||
| const get_enum_1 = require("./optimization/get-enum"); | ||
| const form_item_1 = require("./optimization/form-item"); | ||
| const registerPreCheckTool = (server) => { | ||
@@ -23,5 +28,8 @@ server.registerTool("lowcode-scheme-pre-check", { | ||
| inputSchema: { | ||
| jsonSchema: zod_1.default.string().describe("低代码schema格式的DSL"), | ||
| jsonSchema: zod_1.default.string().describe("当前已生成的转换成低代码的Schema"), | ||
| lowCodeAssetsDone: zod_1.default.boolean().describe('低码物料映射是否完成,完成才执行此任务'), | ||
| }, | ||
| annotations: { | ||
| streamable: true | ||
| } | ||
| }, (input) => __awaiter(void 0, void 0, void 0, function* () { | ||
@@ -54,5 +62,31 @@ const { jsonSchema } = input; | ||
| 要求: | ||
| 根据${jsonSchema}来优化低代码schema格式的DSL | ||
| 【必须执行】以下两个优化检查是强制性的,不可跳过: | ||
| 1. 表格查询参数优化检查(必须执行): | ||
| ${table_search_1.tableSearchPromot} | ||
| 2. 弹窗表单新增优化检查(必须执行): | ||
| ${modal_add_1.modalAddPrompt} | ||
| 3. 权限配置优化检查(必须执行): | ||
| ${permission_1.permissionPrompt} | ||
| 4. 枚举URL转换检查(必须执行): | ||
| ${get_enum_1.getEnumPrompt} | ||
| ⚠️ 重要提示: | ||
| - 以上四项检查必须逐一完成,不得省略任何步骤 | ||
| - 如果代码中存在表格查询场景,必须按照【表格查询参数优化检查】的规则进行验证和优化 | ||
| - 如果代码中存在弹窗表单场景,必须按照【弹窗表单新增优化检查】的规则进行验证和优化 | ||
| - 如果代码中存在权限场景,必须按照【权限配置优化检查】的规则进行验证和优化 | ||
| - 如果代码中存在枚举场景,必须按照【枚举URL转换检查】的规则进行验证和优化 | ||
| - 检查完成后,需要在优化结果中明确说明每项检查的执行情况和修改内容 | ||
| 3. 表单项通用优化检查(必须执行): | ||
| ${form_item_1.formItemOptimizationPrompt} | ||
| **要求**: | ||
| 根据 fewshotSchema(官方示例) 来优化当前已生成的转换成低代码的 Schema:${jsonSchema} | ||
| 检查一下优化之后的schema,结果是一个json | ||
@@ -59,0 +93,0 @@ ` |
@@ -26,2 +26,5 @@ "use strict"; | ||
| var _a; | ||
| // 设置请求和响应的超时时间 | ||
| req.setTimeout(config_1.config.sessionTimeout); | ||
| res.setTimeout(config_1.config.sessionTimeout); | ||
| const sessionId = req.headers['mcp-session-id']; | ||
@@ -76,2 +79,5 @@ let transport; | ||
| console.log("mcp-client 链接建立"); | ||
| // 设置请求和响应的超时时间 | ||
| req.setTimeout(config_1.config.sessionTimeout); | ||
| res.setTimeout(config_1.config.sessionTimeout); | ||
| const sessionId = req.headers['mcp-session-id']; | ||
@@ -78,0 +84,0 @@ if (!sessionId || !transports[sessionId]) { |
+116
-3
@@ -11,4 +11,7 @@ "use strict"; | ||
| }; | ||
| var __importDefault = (this && this.__importDefault) || function (mod) { | ||
| return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.registerAllTools = exports.withResponse = void 0; | ||
| exports.optimizeFewshotExample = exports.getFewshotExample = exports.setFewshotExample = exports.writeLogFile = exports.zipContextByAgent = exports.registerAllTools = exports.withResponse = void 0; | ||
| const analyzeOldPage_1 = require("../mcpTools/analyzeOldPage"); | ||
@@ -20,3 +23,6 @@ const generateLowcodeSchema_1 = require("../mcpTools/generateLowcodeSchema"); | ||
| const preCheck_1 = require("../mcpTools/preCheck"); | ||
| const generateASTDesc_1 = require("../mcpTools/generateASTDesc"); | ||
| const generateMigrationReport_1 = require("../mcpTools/generateMigrationReport"); | ||
| const fs_1 = __importDefault(require("fs")); | ||
| const path_1 = __importDefault(require("path")); | ||
| const os_1 = __importDefault(require("os")); | ||
| const withResponse = (responseHandler) => { | ||
@@ -51,2 +57,4 @@ return (req, res) => __awaiter(void 0, void 0, void 0, function* () { | ||
| (0, listLowcodeAssets_1.registerListLowcodeAssetsTool)(server); | ||
| /** 获取低码物料详情工具 */ | ||
| (0, listLowcodeAssets_1.registerGetLowcodeAssetsDetailTool)(server); | ||
| /** 分析旧页面结构 */ | ||
@@ -61,3 +69,3 @@ (0, analyzeOldPage_1.registerAnalyzeOldPageTool)(server); | ||
| /** 生成迁移报告工具 */ | ||
| (0, generateASTDesc_1.registerGenerateASTDescTool)(server); | ||
| (0, generateMigrationReport_1.registerGenerateASTDescTool)(server); | ||
| /** 解析schema工具 */ | ||
@@ -67,1 +75,106 @@ (0, preCheck_1.registerResolveSchemaTool)(server); | ||
| exports.registerAllTools = registerAllTools; | ||
| /** | ||
| * | ||
| * @param prompt 需要压缩的上下文 | ||
| * @param zipTaskName 压缩任务名称 | ||
| * @param options 压缩选项 | ||
| * @param options.extraPrompt 额外提示 | ||
| * @param options.openZip 是否开启压缩 | ||
| * @returns | ||
| */ | ||
| const zipContextByAgent = (prompt_1, zipTaskName_1, ...args_1) => __awaiter(void 0, [prompt_1, zipTaskName_1, ...args_1], void 0, function* (prompt, zipTaskName, options = {}) { | ||
| const { extraPrompt, openZip = true } = options; | ||
| /** 先关闭压缩 */ | ||
| if (!openZip) | ||
| return prompt; | ||
| const zipPrompt = ` | ||
| You are a professional assistant. Your task is to condense the following context by agent, keeping all critical information and meaning intact. Provide a concise, clear, and precise summary. | ||
| The prompt is: | ||
| ${prompt} | ||
| Please only return the zip prompt, no other text. | ||
| ${extraPrompt ? extraPrompt : ''} | ||
| `; | ||
| try { | ||
| const response = yield fetch('https://yqg-mod-test.yangqianguan.com/api/openAI/askAi', { | ||
| method: 'POST', | ||
| headers: { | ||
| 'Content-Type': 'application/json', | ||
| }, | ||
| body: JSON.stringify({ | ||
| messages: [ | ||
| { | ||
| "role": "user", | ||
| "content": zipPrompt | ||
| } | ||
| ], | ||
| model: 'gpt41' | ||
| }) | ||
| }).then(res => res.json()); | ||
| console.log('==============================================='); | ||
| console.log('压缩任务名称:', zipTaskName); | ||
| console.log('压缩前的长度:', prompt.length); | ||
| console.log('压缩后的长度:', response.data.length); | ||
| console.log('压缩比例:', ((1 - response.data.length / prompt.length) * 100).toFixed(2) + '%'); | ||
| (0, exports.writeLogFile)(`提示词优化-${zipTaskName}`, ` | ||
| before zip: | ||
| ${prompt} | ||
| -=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=- | ||
| after zip: | ||
| ${response.data} | ||
| `); | ||
| console.log('==============================================='); | ||
| return response.data; | ||
| } | ||
| catch (error) { | ||
| return prompt; | ||
| } | ||
| }); | ||
| exports.zipContextByAgent = zipContextByAgent; | ||
| const writeLogFile = (fileName, content) => { | ||
| const userHomeDir = os_1.default.homedir(); | ||
| const lowCodeDir = path_1.default.join(userHomeDir, '.lowCode'); | ||
| const logsDir = path_1.default.join(lowCodeDir, 'logs'); | ||
| // 创建.lowCode目录,如果已存在则跳过 | ||
| if (!fs_1.default.existsSync(lowCodeDir)) { | ||
| fs_1.default.mkdirSync(lowCodeDir); | ||
| } | ||
| // 创建logs目录,如果已存在则跳过 | ||
| if (!fs_1.default.existsSync(logsDir)) { | ||
| fs_1.default.mkdirSync(logsDir); | ||
| } | ||
| const date = new Date(); | ||
| const formatted = date.toLocaleString('zh-CN', { | ||
| year: 'numeric', | ||
| month: '2-digit', | ||
| day: '2-digit', | ||
| hour: '2-digit', | ||
| minute: '2-digit', | ||
| second: '2-digit', | ||
| hour12: false | ||
| }).replace(/\//g, '-').replace(' ', '-'); | ||
| const logFilePath = path_1.default.join(logsDir, `${fileName}-${formatted}`); | ||
| try { | ||
| fs_1.default.writeFileSync(logFilePath, content); | ||
| console.log('日志文件已保存到:', logFilePath); | ||
| } | ||
| catch (error) { | ||
| console.log('写入日志文件失败', error); | ||
| } | ||
| }; | ||
| exports.writeLogFile = writeLogFile; | ||
| let fewshotExample = null; | ||
| const setFewshotExample = (example) => { | ||
| fewshotExample = example; | ||
| }; | ||
| exports.setFewshotExample = setFewshotExample; | ||
| const getFewshotExample = () => { | ||
| return fewshotExample; | ||
| }; | ||
| exports.getFewshotExample = getFewshotExample; | ||
| const optimizeFewshotExample = (schemas, componentsName) => { | ||
| return ''; | ||
| }; | ||
| exports.optimizeFewshotExample = optimizeFewshotExample; |
+1
-1
| { | ||
| "name": "low-code-mcp-stdio", | ||
| "version": "2.0.50", | ||
| "version": "2.1.2", | ||
| "bin": { | ||
@@ -5,0 +5,0 @@ "low-code-mcp-stdio": "build/index-stdio.js" |
| "use strict"; | ||
| var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
| function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
| return new (P || (P = Promise))(function (resolve, reject) { | ||
| function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
| function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
| function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
| step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
| }); | ||
| }; | ||
| var __importDefault = (this && this.__importDefault) || function (mod) { | ||
| return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.registerGenerateASTDescTool = void 0; | ||
| const ast_1 = require("../utils/ast"); | ||
| const zod_1 = __importDefault(require("zod")); | ||
| const registerGenerateASTDescTool = (server) => { | ||
| server.registerTool("generate-migration-report", { | ||
| description: "生成迁移报告", | ||
| inputSchema: { | ||
| filePath: zod_1.default.string().describe("本地源文件的绝对路径"), | ||
| targetPath: zod_1.default.string().describe("本地源文件所在的目录绝对地址"), | ||
| lowcodeJsonPath: zod_1.default.string().describe("低代码页面的schema文件的绝对路径"), | ||
| } | ||
| }, (input) => __awaiter(void 0, void 0, void 0, function* () { | ||
| const { filePath, lowcodeJsonPath, targetPath } = input; | ||
| // 生成AST描述文件,调用本地脚本 | ||
| const astDescPath = yield (0, ast_1.generateASTDesc)(filePath, targetPath); | ||
| return { | ||
| content: [{ | ||
| type: "text", text: ` | ||
| 执行以下任务: | ||
| 1.根据${astDescPath}这个描述文件,结合${filePath}原文件,帮我生成一个ast.json文件写入到ast.json文件中。 | ||
| 这个文件尽可能详细覆盖整个页面,注意请求路径等可能会存在公共前缀。显示分析过程。 | ||
| [1.交互流程,例如点击查询,点击重置,点击非表格中的操作按钮等后续的整个页面渲染的交互流程] | ||
| [2.点击可点击dom的操作事件,分为是否直接调用接口,是否打开弹窗,打开弹窗记录详细弹窗中的后续步骤以及弹窗中的内容,是否跳转链接,是否直接修改数据] | ||
| [3.template模版中条件分支,v-if、v-else相关的处理逻辑] | ||
| [4.js函数中条件分支,if、三目运算、swtich] | ||
| [5.函数方法调用,函数相关可能有打开弹窗,打开弹窗功能需要分析modal中的具体内容跟逻辑,modal弹窗中的字段需要列出,注意modal弹窗中的字段对应显示隐藏条件,比如hide: xxx或其他显示或者权限控制条件,函数也可能调用接口,需要列出具体函数接受参数以及调用的接口参数,注意不要把方法名称当成请求的url,接口url确保准确,可查看原代码实现] | ||
| [6.表格渲染数据,非直接展示的请记录template模版如何处理,例如显隐条件以及dom或者标签颜色] | ||
| [7.表格最后一项如果为操作项需要单独列出,并记录相关按钮的实现功能,如果是打开弹窗需要分析弹窗中的内容跟后续动作,modal弹窗中的字段需要列出,注意modal弹窗中的字段对应显示条件,比如hide: xxx或其他显隐条件。如果是跳转需记录跳转url,操作按钮需详记录相关动作] | ||
| [8.权限点,页面中按钮的权限点,例如v-if='xxx',没有请忽略] | ||
| [9.所有相关枚举,包括静态枚举跟接口获取的枚举,接口获取枚举注意原文件中接口名可能有公共前缀,请注意不要把方法名字当成url,如果没有枚举可不处理] | ||
| 2.${targetPath}/ast.json 是刚刚生成的页面描述文件,${lowcodeJsonPath}对应低代码页面的schema。 | ||
| 请对比两个文件,生成一个详细的低代码功能迁移完整度的报告,直接输出结果,每个对比维度都以表格形式展示。 | ||
| 注意,所有处理number类型相关的考虑保存到小数点后几位,请求相关注意请求路径等可能会存在公共前缀。 | ||
| [1.查询功能,是否自动查询,查询配置的options可能会根据不同条件返回不同options,例如海外国内返回的options可能不一致。每个参数的相关信息组件类型input、select或其他。组件的placeholder,select的枚举配置,枚举配置注意不要把方法名称当成枚举接口的url请准确给出枚举接口url可检索原代码。datepicker精确格式YYYY-MM-DD HH:mm:ss还是YYYY-MM-DD,options中如果各项有联动关系给指出,查询时的组件默认值,查询每一页分页数] | ||
| [2.重置功能] | ||
| [3.操作功能,页面中非表格中的按钮,例如点击按钮打开弹窗的新增功能或上传功能、路由跳转。检查操作功能否具有权限控制以及显隐条件,打开弹窗功能需要分析modal中的具体内容跟逻辑,modal弹窗中的字段需要列出,注意modal弹窗中的字段对应显示隐藏条件,比如hide: xxx,以及各字段之间是否具有相关联动] | ||
| [4.导出功能,页面中非表格中的按钮,例如点击按钮导出数据。如果导出有参数指出,导出场景的参数可能为选中table表格中的id或其他字段,也可能为查询功能的参数也可能为其他,请具体分析] | ||
| [5.table表格的对应展示字段,table的options可能会根据不同条件返回不同options,例如海外国内返回的options可能不一致。每一项如果不是直接展示需要具体列出原代码的处理逻辑,例如template具体如何实现的,template模版处理的逻辑dom或标签以及对应的style,涉及到低代码自定义渲染的请深度分析并展示代码。如果是switch开关的场景点击后判断是否重新调用查询,非直接展示项需要考虑是否可操作,是否具有权限控制、显示隐藏条件比如hide: xxx] | ||
| [6.table表格中最后一列如果为操作项,操作项中的功能按钮单独列出,并按照功能维度检查是否具有显示隐藏的条件以及权限控制,每个按钮对应功能需要深度分析,打开弹窗需要分析弹窗中的内容,modal弹窗中的字段需要列出,注意modal弹窗中的字段对应显示隐藏条件,比如hide: xxx,以及各字段之间是否具有相关联动。表格最后一列如果不是操作项请忽略] | ||
| [7.全局枚举以及枚举接口,包括静态枚举跟接口获取的枚举,接口获取枚举注意原文件中接口名可能有公共前缀,请注意不要把方法名字当成url,没有枚举请忽略] | ||
| [8.原代码接口参数以及API需要单独按照功能维度列出 例如查询功能,重置功能,操作功能,导出功能,获取详情,保存,修改状态以及其他功能,可能具有公共前缀,请注意不要把方法名称当作url] | ||
| [9.权限点单独列出,例如哪些功能点需要具有权限点才可操作,如果没有权限点请忽略]。 | ||
| [11.迁移报告按照原代码中的功能然后跟低代码中的功能对比,如果原代码中没有实现的功能就不用对比了,如果迁移功能不完整需要加上原代码详细实现,可以检索原代码] | ||
| [12.报告结尾列举迁移没有完整的功能,并附上对应的原代码详细实现,可以检索原代码] | ||
| 3. 把迁移报告的markdown文件转成html渲染的文件,并输出到${targetPath}/report.html文件中,样式展示上可以增加一些动画效果,提升格调,菜单导航一定要有锚点绝对定位悬浮在左上角 | ||
| 4.删除${targetPath}/ast.json文件,删除${astDescPath}文件,删除markdown文件 | ||
| ` | ||
| }], | ||
| }; | ||
| })); | ||
| }; | ||
| exports.registerGenerateASTDescTool = registerGenerateASTDescTool; |
| "use strict"; | ||
| var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
| function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
| return new (P || (P = Promise))(function (resolve, reject) { | ||
| function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
| function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
| function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
| step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
| }); | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.taskList = exports.registerGetImg2LowcodeTaskTool = void 0; | ||
| const constant_1 = require("../constant/constant"); | ||
| const zod_1 = require("zod"); | ||
| const registerGetImg2LowcodeTaskTool = (server) => { | ||
| server.registerTool("get-img-2-lowcode-task", { | ||
| description: "antd的json转低代码任务", | ||
| inputSchema: { | ||
| antdJsonSchema: zod_1.z.string().describe("antd的json schema,一般是 json 格式,里面包含页面所有的信息"), | ||
| }, | ||
| }, () => __awaiter(void 0, void 0, void 0, function* () { | ||
| return ({ | ||
| content: [{ | ||
| type: "text", text: ` | ||
| ${exports.taskList.join("\n")} | ||
| ` | ||
| }] | ||
| }); | ||
| })); | ||
| }; | ||
| exports.registerGetImg2LowcodeTaskTool = registerGetImg2LowcodeTaskTool; | ||
| exports.taskList = [ | ||
| `你是一个资深的低代码工程师,有着丰富的把图片转换成低代码页面的经验,现在需要你把当前任务是要把图片转换成低代码页面`, | ||
| '1. 分析表单项配置,表单布局为行内布局', | ||
| `2. 分析jsonschema中的所有操作,比如表单中的操作按钮、表格中的操作列等,分析功能是按钮还是弹窗`, | ||
| `3. 表格列的按钮插槽举例:${constant_1.tableColumnButtonSlotExample}`, | ||
| '4. 调用【映射低码物料工具】获取低代码物料描述', | ||
| '5. 分析antd的json schema中映射使用的组件名称', | ||
| '6. 根据获取的组件名称数组来一次性调用【获取低代码页面示例的schema】工具来获取对应组件的schema,一定要确保组件名称的准确性', | ||
| '7. 直接生成符合规范的低代码schema,不要调用其他工具,只能使用低代码物料描述中存在的组件,不考虑业务逻辑,只生成UI', | ||
| ]; |
| "use strict"; | ||
| var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
| function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
| return new (P || (P = Promise))(function (resolve, reject) { | ||
| function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
| function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
| function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
| step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
| }); | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.registryTranslateDSLTool = registryTranslateDSLTool; | ||
| function registryTranslateDSLTool(server) { | ||
| server.registerTool("lowcode-translate-dsl", { | ||
| description: "把存量页面的代码转成AST结构", | ||
| }, (input) => __awaiter(this, void 0, void 0, function* () { | ||
| const { code } = input; | ||
| return { | ||
| content: [{ type: "text", text: "翻译DSL" }], | ||
| }; | ||
| })); | ||
| } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
High entropy strings
Supply chain riskContains high entropy strings. This could be a sign of encrypted data, leaked secrets or obfuscated code.
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
High entropy strings
Supply chain riskContains high entropy strings. This could be a sign of encrypted data, leaked secrets or obfuscated code.
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
507763
17.44%26
13.04%10500
19.45%19
26.67%2
100%