diff --git a/src/views/quest/node/components/node/type/exporFind.vue b/src/views/quest/node/components/node/type/exporFind.vue index 1b8a873..b5084bf 100644 --- a/src/views/quest/node/components/node/type/exporFind.vue +++ b/src/views/quest/node/components/node/type/exporFind.vue @@ -24,7 +24,7 @@
确认 - 修改配置 + 修改配置
@@ -57,11 +57,12 @@ export default { computed: {}, // 生命周期 - 创建完成(可以访问当前this实例)", created() { + this.init() }, // 方法集合", methods: { - // 根据节点编码获取节点的所有信息,包括参数配置 - getInfo() { + // 初始化 + info() { console.log(this.data) console.log(this.node) }, diff --git a/src/views/quest/node/components/node/type/exporUpd2.vue b/src/views/quest/node/components/node/type/exporUpd2.vue index 9b80938..2a4a2be 100644 --- a/src/views/quest/node/components/node/type/exporUpd2.vue +++ b/src/views/quest/node/components/node/type/exporUpd2.vue @@ -1,53 +1,26 @@ @@ -55,13 +28,14 @@ diff --git a/src/views/quest/node/components/node/type/tableUpd.vue b/src/views/quest/node/components/node/type/tableUpd.vue index f652df3..4f12c72 100644 --- a/src/views/quest/node/components/node/type/tableUpd.vue +++ b/src/views/quest/node/components/node/type/tableUpd.vue @@ -114,6 +114,7 @@ export default { }, /** 表字段查询*/ selectTable(row) { + this.disp.formData.fields = [] this.disp.formData.db = row selectDbTableColumnsByName(row.dbName, row.tableName).then(res => { this.fieldsOptions = res.data diff --git a/src/views/quest/node/components/node/type/uniteFind.vue b/src/views/quest/node/components/node/type/uniteFind.vue index aa4de1f..db2c1f0 100644 --- a/src/views/quest/node/components/node/type/uniteFind.vue +++ b/src/views/quest/node/components/node/type/uniteFind.vue @@ -15,27 +15,28 @@ - - + +    - - + + 返回 - 下一步 + 下一步 - - + - - - + + + +

@@ -51,6 +52,7 @@ // 例如:import 《组件名称》 from '《组件路径》, import {listDisposition} from "@/api/quest/disposition"; import {selectDbTableColumnsByName} from "@/api/tool/gen"; +import {batchAddUpd} from "@/api/quest/disposition"; export default { // import引入的组件需要注入到对象中才能使用" @@ -82,8 +84,8 @@ export default { fields: [], join: '', joinData: { - form: '', - to: '' + form: {}, + to: {} } }, formData: {}, @@ -135,19 +137,39 @@ export default { this.respDispData.join = data.join }else{ this.reqDispData.db.push(data.db) - this.respDispData.fields.push(data.fields) - selectDbTableColumnsByName(data.db.dbName,data.db.tableName).then(res => { - this.reqDispData.fieldList.push(res.data) - }) + this.reqDispData.fields.push(data.fields) } }) }, + // 下一步按钮 + checkFields() { + this.respDispData.db = this.reqDispData.db + this.reqDispData.fieldList = [] + this.reqDispData.fieldList.push(...this.reqDispData.fields[0]) + this.reqDispData.fieldList.push(...this.reqDispData.fields[1]) + // 查询表字段 + this.reqDispData.fields[0].forEach(field => { + if (this.respDispData.joinData.form.fieldName === field.fieldName){ + this.respDispData.joinData.form = field + } + }) + this.reqDispData.fields[1].forEach(field => { + if (this.respDispData.joinData.to.fieldName === field.fieldName){ + this.respDispData.joinData.to = field + } + }) + this.checkFieldsFlag = true + }, // 保存选择 save() { console.log('reqDispData',this.reqDispData) console.log('respDispData',this.respDispData) - this.checkFieldsFlag = false - this.disp.findFlag = false + const dispList = this.getMysqlDisp(this.respDispData) + batchAddUpd(dispList, this.disp.nodeCode).then(res => { + this.$message.success(res.msg) + this.checkFieldsFlag = false + }) + // this.disp.findFlag = false }, clickRow(row) { this.$refs.table.toggleRowSelection(row); @@ -156,9 +178,11 @@ export default { handleSelectionChange(selection) { this.respDispData.fields = selection.map(item => { return { - fieldName: item.columnName, - fieldType: item.columnType, - fieldComment: item.columnComment + tableName: item.tableName, + fieldName: item.fieldName, + fieldType: item.fieldType, + fieldComment: item.fieldComment, + fieldDesc: item.fieldDesc }; }); }, @@ -166,6 +190,7 @@ export default { getVueDisp(dispList) { const db = {} const fields = [] + let tableName = '' let join = '' let joinData = { form: '', @@ -179,27 +204,105 @@ export default { db.tableName = disp.dispValue db.tableComment = disp.dispLabel } + tableName = db.dbName+'.'+db.tableName + db.dbTable = db.dbName+'.'+db.tableName+'('+db.tableComment +')' if (disp.dispKey === 'fields') { fields.push({ + tableName: tableName, fieldName: disp.dispValue, fieldType: disp.dispType, - fieldComment: disp.dispLabel + fieldComment: disp.dispLabel, + fieldDesc: disp.fieldDesc }) } - db.dbTable = db.dbName+'.'+db.tableName+'('+db.tableComment +')' if (disp.dispKey === 'joinDataForm') { - joinData.form = disp.dispValue + joinData.form.push({ + tableName: tableName, + fieldName: disp.dispValue, + fieldType: disp.dispType, + fieldComment: disp.dispLabel, + fieldDesc: disp.fieldDesc + }) } if (disp.dispKey === 'joinDataTo') { - joinData.to = disp.dispValue + joinData.to.push({ + tableName: tableName, + fieldName: disp.dispValue, + fieldType: disp.dispType, + fieldComment: disp.dispLabel, + fieldDesc: disp.fieldDesc + }) } if (disp.dispKey === 'join') { join = disp.dispValue - return {db, fields, join, joinData} } }) + if (join !== '') { + return {db, fields, join, joinData} + } return {db, fields} }, + /** 节点配置--unite 类型转换 vue -> mysql*/ + getMysqlDisp(resp) { + const db = resp.db + const fields = resp.fields + const join = resp.join + const form = resp.joinData.form + const to = resp.joinData.to + // 处理数据库 + const dispList = [] + // 数据库 + db.forEach(item => { + dispList.push({ + nodeCode: this.node.id, // 节点编码 + dispKey: 'db', // 存储编码 + dispLabel: item.tableComment, // 显示名称 + dispValue: item.dbName, // 存储值 + dispType: 'string', // 存储类型 + dispDesc: item.dbTable // 备注信息 + }) + }) + // 表结构 + fields.forEach(field => { + dispList.push({ + nodeCode: this.node.id, + dispKey: 'fields', + dispLabel: field.fieldComment, + dispValue: field.fieldName, + dispType: field.fieldType, + dispDesc: field.tableName + }) + }) + // 连接方式 + dispList.push({ + nodeCode: this.node.id, + dispKey: 'join', + dispLabel: join, + dispValue: join, + dispType: 'String', + dispDesc: '' + }) + // 连接字段1 + dispList.push({ + nodeCode: this.node.id, + dispKey: 'joinDataForm', + dispLabel: form.fieldComment, + dispValue: form.fieldName, + dispType: form.fieldType, + dispDesc: form.tableName + }) + // 连接字段2 + dispList.push({ + nodeCode: this.node.id, + dispKey: 'joinDataTo', + dispLabel: to.fieldComment, + dispValue: to.fieldName, + dispType: to.fieldType, + dispDesc: to.tableName + }) + + return dispList + } } }