diff --git a/src/views/LinkUp/compoment/addAccount.vue b/src/views/LinkUp/compoment/addAccount.vue index 6ec8501..9f52cd1 100644 --- a/src/views/LinkUp/compoment/addAccount.vue +++ b/src/views/LinkUp/compoment/addAccount.vue @@ -12,16 +12,16 @@ title="新增账号" >
@@ -62,6 +62,8 @@ export default { data() { return { dialogVisible: false, + currentForm: [], + currentRules: {}, accountFormRow: [ { elCol: [ @@ -188,25 +190,160 @@ export default { }, ], }, + accountOtherFormRow: [ + { + elCol: [ + { + label: "账号名称", + prop: "name", + tag: "elInput", + span: 24, + }, + ], + }, + { + elCol: [ + { + label: "ip地址", + prop: "ipAddress", + tag: "elInput", + span: 24, + }, + ], + }, + { + elCol: [ + { + label: "端口", + prop: "port", + tag: "elInput", + span: 24, + }, + ], + }, + { + elCol: [ + { + label: "应用Key", + prop: "appKey", + tag: "elInput", + span: 24, + }, + ], + }, + { + elCol: [ + { + label: "应用密钥", + prop: "appSecret", + tag: "elInput", + span: 24, + }, + ], + }, + { + elCol: [ + { + label: "企业ID", + prop: "corpid", + tag: "elInput", + span: 24, + }, + ], + }, + { + elCol: [ + { + label: "应用ID", + prop: "agentid", + tag: "elInput", + span: 24, + }, + ], + }, + ], + accountOtherRules: { + name: [ + { + required: true, + message: "请输入", + trigger: "change, blur", + }, + ], + ipAddress: [ + { + required: true, + message: "请输入", + trigger: "change, blur", + }, + ], + port: [ + { + required: true, + message: "请输入", + trigger: "change, blur", + }, + ], + appKey: [ + { + required: true, + message: "请输入", + trigger: "change, blur", + }, + ], + appSecret: [ + { + required: true, + message: "请输入", + trigger: "change, blur", + }, + ], + corpid: [ + { + required: true, + message: "请输入", + trigger: "change, blur", + }, + ], + agentid: [ + { + required: true, + message: "请输入", + trigger: "change, blur", + }, + ], + }, appID: "", sceneID: "", stepID: "", accountType: "", submitShow: false, //是否显示查看按钮 message: "", + appType: "", }; }, methods: { - openDialog(appID, sceneID, stepID) { - this.submitShow = false; + openDialog(appID, sceneID, stepID, appType) { + this.appType = appType; this.message = ""; - this.queryDictionaryList(); this.appID = appID; this.sceneID = sceneID; this.stepID = stepID; - this.dialogVisible = true; + this.submitShow = false; + if (appType == "9") { + this.currentForm = this.accountFormRow; + this.currentRules = this.accountRules; + this.queryDictionaryList(); + } else { + this.submitShow = true; + this.currentForm = this.accountOtherFormRow; + this.currentRules = this.accountOtherRules; + } this.$nextTick(() => { - this.$refs.customForm?.resetFields("ruleForm"); + this.dialogVisible = true; + this.$nextTick(() => { + this.$refs.customForm?.resetFields("ruleForm"); + }); }); }, async queryDictionaryList() { @@ -230,6 +367,7 @@ export default { if (valid) { let params = { ...this.$refs.customForm.ruleForm, + appType: this.appType, }; this.verifyDataBase(params); } else { @@ -257,6 +395,7 @@ export default { } }, handleConfirmClick() { + this.openLoading("保存") this.$refs.customForm.$refs["ruleForm"].validate((valid) => { if (valid) { let params = { @@ -265,6 +404,7 @@ export default { status: 1, flowId: this.sceneID, stepId: this.stepID, + appType: this.appType, }; this.SaveAccountData(params); } else { diff --git a/src/views/LinkUp/compoment/addDialogChunk.vue b/src/views/LinkUp/compoment/addDialogChunk.vue index 027a64e..b0c6036 100644 --- a/src/views/LinkUp/compoment/addDialogChunk.vue +++ b/src/views/LinkUp/compoment/addDialogChunk.vue @@ -25,7 +25,7 @@ style="background: #fff" > -
+
添加新步骤
+ + +
+
+ 测试结果输出 +
+ 关闭 +
+
+
+ + +
+
+ + +
+
+ +
+
-
+
暂存 - 点击测试 + 点击测试 +
+
+ + + + + + + +
@@ -670,6 +731,7 @@ import addAccount from "./addAccount.vue"; import baseForm from "@/components/base/baseNewForm"; import treeNode from "./TreeNode"; import IconsDialog from "../../tool/build/IconsDialog.vue"; +import jsonView from "vue-json-views"; export default { components: { editSence, @@ -679,6 +741,7 @@ export default { baseForm, treeNode, IconsDialog, + jsonView, }, data() { return { @@ -750,48 +813,23 @@ export default { representation: false, selectedNode: "", representationActiveName: "first", - treeData: { - user: { - id: 1001, - profile: { - name: "李四", - email: "lisi@example.com", - settings: { - theme: "dark", - notifications: { - email: true, - sms: false, - push: true, - }, - }, - }, - permissions: ["read", "write", "admin"], - metadata: { - created_at: "2023-01-15T10:30:00Z", - updated_at: "2024-03-20T15:45:30Z", - version: 2.1, - }, - }, - config: { - database: { - host: "localhost", - port: 5432, - ssl: false, - }, - features: { - experimental: ["ai_assist", "real_time_sync"], - stable: ["user_management", "data_export"], - }, - }, - }, + treeData: {}, currenrActiveNodeRef: "", lastSelectedTokenIndex: -1, representationData: representationData, savedRange: null, // ⬅️ 用于存储当前 range + TestResultDisplayArea: false, //测试结果展示区 + jsonTestResultData: {}, + pageFormData: { + rowNum: "1", + pageLimit: "100", + }, + + parameterType: "body", //参数类型 }; }, methods: { - async saveTestTableEvent() { + async saveTestTableEvent(type) { if (!this.outsideFormData.tableName) { this.$vmNews("请先选择表"); return; @@ -808,7 +846,17 @@ export default { stepAccountId: data.step_acc_id, actionName: data.apiName || data.plugName, tableName: this.outsideFormData.tableName, + appType: this.currentRowData.options.appType, }; + if ( + this.currentRowData.options && + this.currentRowData.options.appType == "9" && + this.currentRowData.options.apiName.includes("查询") + ) { + params.rowNum = this.pageFormData.rowNum; + params.pageLimit = this.pageFormData.pageLimit; + } + let res = await authApi( "sysFlowStepConfigService", "", @@ -816,8 +864,12 @@ export default { "", params ); - if(res.status == "200"){ - this.$vmNews("暂存成功!","success") + if (res.status == "200") { + if (type == "hit") { + this.hitTesting(); + } else { + this.$vmNews("暂存成功!", "success"); + } } }, extractEditorItems(rootElement) { @@ -850,8 +902,33 @@ export default { return result; }, - hitTesting(){ - + async hitTesting() { + if (!this.outsideFormData.tableName) { + this.$vmNews("请先选择表"); + return; + } + this.openLoading("测试"); + this.representation = false; + let data = this.currentRowData.options; + let params = { + stepID: data.stepID, + tableName: this.outsideFormData.tableName, + }; + let res = await authApi( + "sysFlowStepConfigService", + "", + "testSql", + "", + params + ); + if (res.status == "200") { + this.TestResultDisplayArea = true; + this.jsonTestResultData = res || {}; + } + }, + closeTestResultArea() { + this.TestResultDisplayArea = false; + this.jsonTestResultData = {}; }, /** * 打开弹窗 @@ -871,6 +948,10 @@ export default { this.triggerMode = triggerMode; // 显示审核操作弹窗 this.examineOperateDialog = true; + this.representation = false; + this.TestResultDisplayArea = false; + this.jsonTestResultData = {}; + this.parameterType = "body"; // 显示场景加载状态 this.sceneLoading = true; // 5 秒后隐藏场景加载状态 @@ -1088,6 +1169,7 @@ export default { this.apiIDActiv = ""; this.userActivId = ""; this.CurrentAppRow = {}; + if (index === 0) { this.activeTabName = "选择操作"; } else { @@ -1097,9 +1179,30 @@ export default { // 获取应用列表 await this.getAppList(); // 获取场景步骤数据 + await this.queryNodeList(); + // 步骤详情 await this.GetSceneStepData(); } }, + /** + * 获取场景映射动态关系 + */ + async queryNodeList() { + let params = { + flowId: this.sceneID, + stepId: this.currentRowData.options.stepID, + }; + let res = await authApi( + "sysFlowStepConfigService", + "", + "queryNodeList", + "", + params + ); + if (res.status == "200") { + this.treeData = res.attribute || {}; + } + }, /** * 获取场景步骤数据 */ @@ -1139,6 +1242,8 @@ export default { this.pluginList = []; // 清空用户列表 this.userList = []; + // 清空表字段 + this.outsideColumns = []; if (this.currentRowData.options.appId) { // 更新当前选中的应用 ID this.appActivIndex = this.currentRowData.options.appId; @@ -1166,6 +1271,10 @@ export default { if (this.currentRowData.options.apiId) { // 更新选择的 API ID this.apiIdActiv = this.currentRowData.options.apiId; + // 非数据库应用 + if (this.currentRowData.options.appType != "9") { + this.queryApiConfig(); + } } else { // 重置选择的 API ID this.apiIdActiv = ""; @@ -1185,8 +1294,10 @@ export default { // 更新当前选择的应用账号名称 this.CurrentAppRow.step_acc_name = this.currentRowData.options.step_acc_name; - // 获取表数据 - this.queryTables(this.userActivId); + if (this.currentRowData.options.appType == "9") { + // 获取表数据 + this.queryTables(this.userActivId); + } } else { // 重置选择的用户 ID this.userActivId = ""; @@ -1324,15 +1435,11 @@ export default { * @param {any} value 标签页值 */ handleOtherTabClick(value) { - console.log( - this.activeOtherTabName, - this.userActivId, - this.outsideFormData.tableName - ); if ( this.activeOtherTabName == "配置应用" && this.userActivId && - this.outsideFormData.tableName + this.outsideFormData.tableName && + this.currentRowData.options.appType == "9" ) { this.queryColumns(this.outsideFormData.tableName); } @@ -1432,6 +1539,8 @@ export default { this.pluginList = []; this.userActivId = ""; this.userList = []; + this.jsonTestResultData = {}; + this.TestResultDisplayArea = false; // 保存应用信息 this.matchAppData(row); // 清空步骤配置 @@ -1533,7 +1642,7 @@ export default { this.activeApiPliginTabName = e; }, // 选择API - hangleApiClickEvent(item) { + async hangleApiClickEvent(item) { this.pluginActiv = ""; this.currentRowData.options.plugId = ""; this.currentRowData.options.plugName = ""; @@ -1548,7 +1657,11 @@ export default { // 更新当前步骤的资源类型 this.currentRowData.options.actionType = this.activeApiPliginTabName; // 切换到选择账号标签页 - this.activeOtherTabName = "选择账号"; + if (this.userActivId) { + this.activeOtherTabName = "配置应用"; + } else { + this.activeOtherTabName = "选择账号"; + } let params = { flowId: this.sceneID, id: this.currentRowData.options.stepID, @@ -1559,7 +1672,37 @@ export default { apiName: item.apiName, }; // 保存场景步骤数据 - this.SaveSceneStepData(params); + await this.SaveSceneStepData(params); + // 非数据库应用 + if (this.currentRowData.options.appType != "9") { + this.queryApiConfig(); + } + }, + // 获取表字段 + async queryApiConfig() { + if (!this.currentRowData.options.apiId) { + return; + } + this.outsideColumns = []; + let params = { + stepId: this.currentRowData.options.stepID, //账户id + apiId: this.currentRowData.options.apiId, + type: this.parameterType, + }; + let res = await authApi( + "sysFlowStepApiConfigService", + "", + "queryApiConfig", + "", + params + ); + this.drawMask = false; + if (res.status == "200") { + this.outsideColumns = res.attribute || []; + this.$nextTick(() => { + // this.getStepConfig(); + }); + } }, // 选择插件 hanglePluginClickEvent(item) { @@ -1602,7 +1745,8 @@ export default { this.$refs.addAccount.openDialog( this.appActivIndex, this.sceneID, - this.currentRowData.options.stepID + this.currentRowData.options.stepID, + this.currentRowData.options.appType ); }, /** @@ -1636,17 +1780,19 @@ export default { id: this.currentRowData.options.stepID, step_acc_name: item.name, step_acc_id: item.id, - tableName: "", + tableName: "-1", }; // 保存场景步骤数据 await this.SaveSceneStepData(params); // 切换到配置应用 this.activeOtherTabName = "配置应用"; - // 获取表数据 - await this.queryTables(item.id); - this.$nextTick(() => { - this.resetForm("outsideForm"); - }); + if (this.currentRowData.options.appType == "9") { + // 获取表数据 + await this.queryTables(item.id); + this.$nextTick(() => { + this.resetForm("outsideForm"); + }); + } }, /** * 重置表单 @@ -1740,6 +1886,14 @@ export default { this.matchEditorItems(root, item.fieldName, item.html_label); }); } + if ( + this.currentRowData.options && + this.currentRowData.options.appType == "9" && + this.currentRowData.options.apiName.includes("查询") + ) { + this.pageFormData.rowNum = res.attribute.rowNum || "1"; + this.pageFormData.pageLimit = res.attribute.pageLimit || "100"; + } } }, matchEditorItems(rootElement, rootName, rootHtml) { @@ -1838,7 +1992,7 @@ export default { editSceneName() { // 编辑场景名称的参数 let row = { - flowId: this.sceneID, + id: this.sceneID, }; // 在下一个 DOM 更新周期后打开编辑场景名称的弹窗 this.$nextTick(() => { @@ -1905,6 +2059,12 @@ export default { // 清空用户列表 this.userList = []; this.representation = false; + this.TestResultDisplayArea = false; + // 重置分页 + this.pageFormData = { + rowNum: "1", + pageLimit: "100", + }; }, representationChange() { if (!this.currenrActiveNodeRef) return; @@ -1965,20 +2125,8 @@ export default { handleEditorClick(e, columnName, rowIndex) { const editor = this.$refs["contentEditor" + columnName + rowIndex][0]; this.currenrActiveNodeRef = "contentEditor" + columnName + rowIndex; - - // // 如果点击的不是token,清除选中状态 - // if ( - // !e.target.classList.contains("content-token") && - // !e.target.closest(".content-token") - // ) { - // this.clearTokenSelection(columnName, rowIndex); - // } - - // // 确保编辑器获得焦点 - // if (e.target === editor || editor.contains(e.target)) { editor.focus(); this.saveRange(); - // } }, // 处理粘贴事件 handlePaste(e, columnName, rowIndex) { @@ -2042,6 +2190,7 @@ export default { let nodeRef = "contentEditor" + columnName + rowIndex; this.currenrActiveNodeRef = nodeRef; this.representation = true; + this.TestResultDisplayArea = false; this.representationActiveName = "first"; // 这段代码的目的是 让光标停留在最后一个span标签后面 @@ -2957,6 +3106,7 @@ export default { ::v-deep .el-collapse-item__header { padding-left: 10px !important; } + // ------------------------ .editor-container { flex: 1; @@ -3107,12 +3257,53 @@ export default { .Columnsbtn { margin: 10px 0; display: flex; - justify-content: flex-end; + justify-content: flex-end; } .fixedChildTable { height: calc(100vh - 360px); overflow: auto; } + +.drawParent { + position: relative; +} +.TestResultDisplayArea { + width: 400px; + height: calc(100% - 10px); + position: absolute; + right: 10px; + top: 5px; + background-color: #fff; + box-sizing: border-box; + box-shadow: 0 0 8px #0000001a; + border-radius: 4px; + z-index: 100; + overflow: hidden; +} + +.testResultBoxTitle { + display: flex; + padding: 15px 10px; + background: #333333; + font-size: 14px; + font-weight: bold; + color: #fff; + justify-content: space-between; + border-radius: 4px 4px 0 0; + + .closeTextBox { + cursor: pointer; + } +} + +.jsonTestResultBox { + height: calc(100% - 90px); + overflow: auto; +} + +::v-deep .el-alert { + padding: 10px !important; +} diff --git a/src/views/LinkUp/compoment/addSence.vue b/src/views/LinkUp/compoment/addSence.vue index 45ab94f..76d85e7 100644 --- a/src/views/LinkUp/compoment/addSence.vue +++ b/src/views/LinkUp/compoment/addSence.vue @@ -170,8 +170,8 @@ export default { params ); if (res.status == "200") { - this.$refs.senceForm.choiceAssignment(res.data[0]); - this.triggerModeId = res.data[0].triggerMode; + this.$refs.senceForm.choiceAssignment(res.attribute[0]); + this.triggerModeId = res.attribute[0].triggerMode; } }, choseType(row) { diff --git a/src/views/LinkUp/compoment/editSence.vue b/src/views/LinkUp/compoment/editSence.vue index cb42ca8..829ae4b 100644 --- a/src/views/LinkUp/compoment/editSence.vue +++ b/src/views/LinkUp/compoment/editSence.vue @@ -44,23 +44,17 @@
-
+ + + diff --git a/src/views/LinkUp/index.vue b/src/views/LinkUp/index.vue index f02764f..cd5bd35 100644 --- a/src/views/LinkUp/index.vue +++ b/src/views/LinkUp/index.vue @@ -358,6 +358,10 @@ ref="addDialogChunk" @examineHandleClose="resetTable" > +
@@ -372,6 +376,7 @@ import addSence from "@/views/LinkUp/compoment/addSence.vue"; import projectClassificationRightDialog from "@/views/projectClassification/rightDialog.vue"; import authorizationDialog from "@/views/projectClassification/authorizationDialog.vue"; import addDialogChunk from "./compoment/addDialogChunk.vue"; +import viewDialogChunk from "./compoment/viewDialogChunk.vue"; export default { components: { baseLayout, @@ -381,6 +386,7 @@ export default { projectClassificationRightDialog, authorizationDialog, addDialogChunk, + viewDialogChunk }, data() { return { @@ -524,17 +530,9 @@ export default { // 按钮点击事件 getFuncBtn(btnEven) { if (btnEven.menuName == "新增") { - // this.$refs.addDialogChunk.openDialog( - // "-4252471217359269890", - // "3-33003", - // "add", - // 3 - // ); - this.$refs.addSence.openDialog("", "add", this.projectClassificationID); } }, - //hyt 2024/08/14 切换豆腐块 onFixedBtn(flag) { this.$refs.layoutNew.pageClear(); this.pageModel.page = 1;