mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-24 01:50:28 +08:00
fix: 修复setup导致open失效问题
This commit is contained in:
@@ -34,7 +34,7 @@ const SqlExecBox = (props: SqlExecProps): void => {
|
|||||||
if (boxInstance) {
|
if (boxInstance) {
|
||||||
const boxVue = boxInstance.component
|
const boxVue = boxInstance.component
|
||||||
// 调用open方法显示弹框,注意不能使用boxVue.ctx来调用组件函数(build打包后ctx会获取不到)
|
// 调用open方法显示弹框,注意不能使用boxVue.ctx来调用组件函数(build打包后ctx会获取不到)
|
||||||
boxVue.proxy.open(props);
|
boxVue.exposed.open(props);
|
||||||
} else {
|
} else {
|
||||||
boxInstance = renderBox()
|
boxInstance = renderBox()
|
||||||
SqlExecBox(props)
|
SqlExecBox(props)
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ const {
|
|||||||
dialogVisible,
|
dialogVisible,
|
||||||
sqlValue,
|
sqlValue,
|
||||||
remark,
|
remark,
|
||||||
btnLoading
|
btnLoading,
|
||||||
} = toRefs(state)
|
} = toRefs(state)
|
||||||
|
|
||||||
state.sqlValue = props.sql as any;
|
state.sqlValue = props.sql as any;
|
||||||
@@ -146,6 +146,9 @@ const open = (props: SqlExecProps) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
defineExpose({ open })
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.codesql {
|
.codesql {
|
||||||
|
|||||||
@@ -160,10 +160,14 @@ func doUpdate(update *sqlparser.Update, execSqlReq *DbSqlExecReq, dbSqlExec *ent
|
|||||||
updateColumnsAndPrimaryKey := strings.Join(updateColumns, ",") + "," + primaryKey
|
updateColumnsAndPrimaryKey := strings.Join(updateColumns, ",") + "," + primaryKey
|
||||||
// 查询要更新字段数据的旧值,以及主键值
|
// 查询要更新字段数据的旧值,以及主键值
|
||||||
selectSql := fmt.Sprintf("SELECT %s FROM %s %s LIMIT 200", updateColumnsAndPrimaryKey, tableStr, where)
|
selectSql := fmt.Sprintf("SELECT %s FROM %s %s LIMIT 200", updateColumnsAndPrimaryKey, tableStr, where)
|
||||||
_, res, _ := dbInstance.SelectData(selectSql)
|
_, res, err := dbInstance.SelectData(selectSql)
|
||||||
|
if err == nil {
|
||||||
|
bytes, _ := json.Marshal(res)
|
||||||
|
dbSqlExec.OldValue = string(bytes)
|
||||||
|
} else {
|
||||||
|
dbSqlExec.OldValue = err.Error()
|
||||||
|
}
|
||||||
|
|
||||||
bytes, _ := json.Marshal(res)
|
|
||||||
dbSqlExec.OldValue = string(bytes)
|
|
||||||
dbSqlExec.Table = tableName
|
dbSqlExec.Table = tableName
|
||||||
dbSqlExec.Type = entity.DbSqlExecTypeUpdate
|
dbSqlExec.Type = entity.DbSqlExecTypeUpdate
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user