diff --git a/mayfly_go_web/src/views/ops/db/SqlExec.vue b/mayfly_go_web/src/views/ops/db/SqlExec.vue index 1aab107c..d9ea447b 100644 --- a/mayfly_go_web/src/views/ops/db/SqlExec.vue +++ b/mayfly_go_web/src/views/ops/db/SqlExec.vue @@ -71,7 +71,7 @@ diff --git a/mayfly_go_web/src/views/ops/db/component/sqleditor/DbSqlEditor.vue b/mayfly_go_web/src/views/ops/db/component/sqleditor/DbSqlEditor.vue index ca7a918e..9a948ae6 100644 --- a/mayfly_go_web/src/views/ops/db/component/sqleditor/DbSqlEditor.vue +++ b/mayfly_go_web/src/views/ops/db/component/sqleditor/DbSqlEditor.vue @@ -148,7 +148,6 @@ import { buildProgressProps } from '@/components/progress-notify/progress-notify import ProgressNotify from '@/components/progress-notify/progress-notify.vue'; import syssocket from '@/common/syssocket'; import SvgIcon from '@/components/svgIcon/index.vue'; -import { getDbDialect } from '../../dialect'; import { Pane, Splitpanes } from 'splitpanes'; const emits = defineEmits(['saveSqlSuccess']); @@ -453,7 +452,7 @@ const formatSql = () => { return; } - const formatDialect = getDbDialect(getNowDbInst().type).getInfo().formatSqlDialect; + const formatDialect = getNowDbInst().getDialect().getInfo().formatSqlDialect; let sql = monacoEditor.getModel()?.getValueInRange(selection); // 有选中sql则格式化并替换选中sql, 否则格式化编辑器所有内容 diff --git a/mayfly_go_web/src/views/ops/db/component/table/ColumnFormItem.vue b/mayfly_go_web/src/views/ops/db/component/table/ColumnFormItem.vue index 62052828..93ba918f 100644 --- a/mayfly_go_web/src/views/ops/db/component/table/ColumnFormItem.vue +++ b/mayfly_go_web/src/views/ops/db/component/table/ColumnFormItem.vue @@ -6,7 +6,6 @@ :disabled="disabled" @blur="handleBlur" :class="`w100 mb4 ${showEditorIcon ? 'string-input-container-show-icon' : ''}`" - input-style="text-align: center; height: 26px;" size="small" v-model="itemValue" :placeholder="placeholder" @@ -20,7 +19,6 @@ :disabled="disabled" @blur="handleBlur" class="w100 mb4" - input-style="text-align: center; height: 26px;" size="small" v-model.number="itemValue" :placeholder="placeholder" @@ -185,9 +183,6 @@ const getEditorLangByValue = (value: any) => { .el-input__prefix { display: none; } - .el-input__inner { - text-align: center; - } } .edit-time-picker-popper { diff --git a/mayfly_go_web/src/views/ops/db/component/table/DbTableData.vue b/mayfly_go_web/src/views/ops/db/component/table/DbTableData.vue index 02750199..7577f3d0 100644 --- a/mayfly_go_web/src/views/ops/db/component/table/DbTableData.vue +++ b/mayfly_go_web/src/views/ops/db/component/table/DbTableData.vue @@ -137,13 +137,25 @@ + + + + diff --git a/mayfly_go_web/src/views/ops/db/component/table/DbTableDataOp.vue b/mayfly_go_web/src/views/ops/db/component/table/DbTableDataOp.vue index dbf56235..d8dabaa6 100644 --- a/mayfly_go_web/src/views/ops/db/component/table/DbTableDataOp.vue +++ b/mayfly_go_web/src/views/ops/db/component/table/DbTableDataOp.vue @@ -234,32 +234,16 @@ - - - - - - - - + @@ -269,11 +253,11 @@ import { ElMessage } from 'element-plus'; import { DbInst } from '@/views/ops/db/db'; import DbTableData from './DbTableData.vue'; -import { DbDialect, getDbDialect } from '@/views/ops/db/dialect'; +import { DbDialect } from '@/views/ops/db/dialect'; import SvgIcon from '@/components/svgIcon/index.vue'; -import ColumnFormItem from './ColumnFormItem.vue'; import { useEventListener, useStorage } from '@vueuse/core'; import { copyToClipboard } from '@/common/utils/string'; +import DbTableDataForm from './DbTableDataForm.vue'; const props = defineProps({ dbId: { @@ -294,7 +278,6 @@ const props = defineProps({ }, }); -const dataForm: any = ref(null); const dbTableRef: Ref = ref(null); const condInputRef: Ref = ref(null); const columnNameSearchInputRef: Ref = ref(null); @@ -341,7 +324,6 @@ const state = reactive({ addDataDialog: { data: {}, title: '', - placeholder: '', visible: false, }, tableHeight: '600px', @@ -349,7 +331,7 @@ const state = reactive({ dbDialect: {} as DbDialect, }); -const { datas, condition, loading, columns, pageNum, pageSize, pageSizes, sql, hasUpdatedFileds, conditionDialog, addDataDialog, dbDialect } = toRefs(state); +const { datas, condition, loading, columns, pageNum, pageSize, pageSizes, sql, hasUpdatedFileds, conditionDialog, addDataDialog } = toRefs(state); watch( () => props.tableHeight, @@ -367,7 +349,7 @@ onMounted(async () => { state.tableHeight = props.tableHeight; await onRefresh(); - state.dbDialect = getDbDialect(getNowDbInst().type); + state.dbDialect = getNowDbInst().getDialect(); useEventListener('click', handlerWindowClick); }); @@ -601,46 +583,6 @@ const onShowAddDataDialog = async () => { state.addDataDialog.title = `添加'${props.tableName}'表数据`; state.addDataDialog.visible = true; }; - -const closeAddDataDialog = () => { - state.addDataDialog.visible = false; - state.addDataDialog.data = {}; -}; - -// 添加新数据行 -const addRow = async () => { - dataForm.value.validate(async (valid: boolean) => { - if (valid) { - const dbInst = getNowDbInst(); - const data = state.addDataDialog.data; - // key: 字段名,value: 字段名提示 - let obj: any = {}; - for (let item of state.columns) { - const value = data[item.columnName]; - if (!value) { - continue; - } - obj[`${dbInst.wrapName(item.columnName)}`] = DbInst.wrapValueByType(value); - } - let columnNames = Object.keys(obj).join(','); - let values = Object.values(obj).join(','); - // 获取schema - let schema = ''; - let arr = props.dbName?.split('/'); - if (arr && arr.length > 1) { - schema = dbInst.wrapName(arr[1]) + '.'; - } - let sql = `INSERT INTO ${schema}${dbInst.wrapName(props.tableName)} (${columnNames}) VALUES (${values});`; - dbInst.promptExeSql(props.dbName, sql, null, () => { - closeAddDataDialog(); - onRefresh(); - }); - } else { - ElMessage.error('请正确填写数据信息'); - return false; - } - }); -};