mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-04 00:10:25 +08:00
feat: dbms表数据新增表单视图
This commit is contained in:
@@ -17,7 +17,7 @@
|
|||||||
"cropperjs": "^1.6.1",
|
"cropperjs": "^1.6.1",
|
||||||
"dayjs": "^1.11.11",
|
"dayjs": "^1.11.11",
|
||||||
"echarts": "^5.5.1",
|
"echarts": "^5.5.1",
|
||||||
"element-plus": "^2.7.6",
|
"element-plus": "^2.7.7",
|
||||||
"js-base64": "^3.7.7",
|
"js-base64": "^3.7.7",
|
||||||
"jsencrypt": "^3.3.2",
|
"jsencrypt": "^3.3.2",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
"sql-formatter": "^15.0.2",
|
"sql-formatter": "^15.0.2",
|
||||||
"trzsz": "^1.1.5",
|
"trzsz": "^1.1.5",
|
||||||
"uuid": "^9.0.1",
|
"uuid": "^9.0.1",
|
||||||
"vue": "^3.4.31",
|
"vue": "^3.4.32",
|
||||||
"vue-router": "^4.4.0",
|
"vue-router": "^4.4.0",
|
||||||
"xterm": "^5.3.0",
|
"xterm": "^5.3.0",
|
||||||
"xterm-addon-fit": "^0.8.0",
|
"xterm-addon-fit": "^0.8.0",
|
||||||
@@ -49,15 +49,15 @@
|
|||||||
"@typescript-eslint/eslint-plugin": "^6.7.4",
|
"@typescript-eslint/eslint-plugin": "^6.7.4",
|
||||||
"@typescript-eslint/parser": "^6.7.4",
|
"@typescript-eslint/parser": "^6.7.4",
|
||||||
"@vitejs/plugin-vue": "^5.0.5",
|
"@vitejs/plugin-vue": "^5.0.5",
|
||||||
"@vue/compiler-sfc": "^3.4.31",
|
"@vue/compiler-sfc": "^3.4.32",
|
||||||
"code-inspector-plugin": "^0.4.5",
|
"code-inspector-plugin": "^0.4.5",
|
||||||
"dotenv": "^16.3.1",
|
"dotenv": "^16.3.1",
|
||||||
"eslint": "^8.35.0",
|
"eslint": "^8.35.0",
|
||||||
"eslint-plugin-vue": "^9.25.0",
|
"eslint-plugin-vue": "^9.25.0",
|
||||||
"prettier": "^3.2.5",
|
"prettier": "^3.2.5",
|
||||||
"sass": "^1.77.6",
|
"sass": "^1.77.8",
|
||||||
"typescript": "^5.5.3",
|
"typescript": "^5.5.3",
|
||||||
"vite": "^5.3.3",
|
"vite": "^5.3.4",
|
||||||
"vue-eslint-parser": "^9.4.2"
|
"vue-eslint-parser": "^9.4.2"
|
||||||
},
|
},
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
:clearable="false"
|
:clearable="false"
|
||||||
type="Date"
|
type="Date"
|
||||||
value-format="YYYY-MM-DD"
|
value-format="YYYY-MM-DD"
|
||||||
placeholder="选择日期"
|
:placeholder="`选择日期-${placeholder}`"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
:clearable="false"
|
:clearable="false"
|
||||||
type="datetime"
|
type="datetime"
|
||||||
value-format="YYYY-MM-DD HH:mm:ss"
|
value-format="YYYY-MM-DD HH:mm:ss"
|
||||||
placeholder="选择日期时间"
|
:placeholder="`选择日期时间-${placeholder}`"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<el-time-picker
|
<el-time-picker
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
v-model="itemValue"
|
v-model="itemValue"
|
||||||
:clearable="false"
|
:clearable="false"
|
||||||
value-format="HH:mm:ss"
|
value-format="HH:mm:ss"
|
||||||
placeholder="选择时间"
|
:placeholder="`选择时间-${placeholder}`"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -258,12 +258,10 @@ const cmDataDel = new ContextmenuItem('deleteData', '删除')
|
|||||||
return state.table == '';
|
return state.table == '';
|
||||||
});
|
});
|
||||||
|
|
||||||
const cmDataEdit = new ContextmenuItem('editData', '编辑行')
|
const cmFormView = new ContextmenuItem('formView', '表单视图').withIcon('Document').withOnClick(() => onEditRowData());
|
||||||
.withIcon('edit')
|
// .withHideFunc(() => {
|
||||||
.withOnClick(() => onEditRowData())
|
// return state.table == '';
|
||||||
.withHideFunc(() => {
|
// });
|
||||||
return state.table == '';
|
|
||||||
});
|
|
||||||
|
|
||||||
const cmDataGenInsertSql = new ContextmenuItem('genInsertSql', 'Insert SQL')
|
const cmDataGenInsertSql = new ContextmenuItem('genInsertSql', 'Insert SQL')
|
||||||
.withIcon('tickets')
|
.withIcon('tickets')
|
||||||
@@ -595,7 +593,7 @@ const dataContextmenuClick = (event: any, rowIndex: number, column: any, data: a
|
|||||||
const { clientX, clientY } = event;
|
const { clientX, clientY } = event;
|
||||||
state.contextmenu.dropdown.x = clientX;
|
state.contextmenu.dropdown.x = clientX;
|
||||||
state.contextmenu.dropdown.y = clientY;
|
state.contextmenu.dropdown.y = clientY;
|
||||||
state.contextmenu.items = [cmDataCopyCell, cmDataDel, cmDataEdit, cmDataGenInsertSql, cmDataGenJson, cmDataExportCsv, cmDataExportSql];
|
state.contextmenu.items = [cmDataCopyCell, cmDataDel, cmFormView, cmDataGenInsertSql, cmDataGenJson, cmDataExportCsv, cmDataExportSql];
|
||||||
contextmenuRef.value.openContextmenu({ column, rowData: data });
|
contextmenuRef.value.openContextmenu({ column, rowData: data });
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -627,12 +625,12 @@ const onDeleteData = async () => {
|
|||||||
const onEditRowData = () => {
|
const onEditRowData = () => {
|
||||||
const selectionDatas = Array.from(selectionRowsMap.values());
|
const selectionDatas = Array.from(selectionRowsMap.values());
|
||||||
if (selectionDatas.length > 1) {
|
if (selectionDatas.length > 1) {
|
||||||
ElMessage.warning('只能编辑一行数据');
|
ElMessage.warning('只能选择一行数据');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const data = selectionDatas[0];
|
const data = selectionDatas[0];
|
||||||
state.tableDataFormDialog.data = { ...data };
|
state.tableDataFormDialog.data = { ...data };
|
||||||
state.tableDataFormDialog.title = `编辑表'${props.table}'数据`;
|
state.tableDataFormDialog.title = state.table ? `'${props.table}'表单数据` : '表单视图';
|
||||||
state.tableDataFormDialog.visible = true;
|
state.tableDataFormDialog.visible = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -648,7 +646,7 @@ const onGenerateJson = async () => {
|
|||||||
// 按列字段重新排序对象key
|
// 按列字段重新排序对象key
|
||||||
const jsonObj = [];
|
const jsonObj = [];
|
||||||
for (let selectionData of selectionDatas) {
|
for (let selectionData of selectionDatas) {
|
||||||
let obj = {};
|
let obj: any = {};
|
||||||
for (let column of state.columns) {
|
for (let column of state.columns) {
|
||||||
if (column.show) {
|
if (column.show) {
|
||||||
obj[column.title] = selectionData[column.dataKey];
|
obj[column.title] = selectionData[column.dataKey];
|
||||||
@@ -752,7 +750,7 @@ const submitUpdateFields = async () => {
|
|||||||
|
|
||||||
for (let updateRow of cellUpdateMap.values()) {
|
for (let updateRow of cellUpdateMap.values()) {
|
||||||
const rowData = { ...updateRow.rowData };
|
const rowData = { ...updateRow.rowData };
|
||||||
let updateColumnValue = {};
|
let updateColumnValue: any = {};
|
||||||
|
|
||||||
for (let k of updateRow.columnsMap.keys()) {
|
for (let k of updateRow.columnsMap.keys()) {
|
||||||
const v = updateRow.columnsMap.get(k);
|
const v = updateRow.columnsMap.get(k);
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
:key="column.columnName"
|
:key="column.columnName"
|
||||||
class="w100 mb5"
|
class="w100 mb5"
|
||||||
:prop="column.columnName"
|
:prop="column.columnName"
|
||||||
:required="!column.nullable && !column.isPrimaryKey && !column.isIdentity"
|
:required="props.tableName != '' && !column.nullable && !column.isPrimaryKey && !column.isIdentity"
|
||||||
>
|
>
|
||||||
<template #label>
|
<template #label>
|
||||||
<span class="pointer" :title="`${column.columnType} | ${column.columnComment}`">
|
<span class="pointer" :title="column?.columnComment ? `${column.columnType} | ${column.columnComment}` : column.columnType">
|
||||||
{{ column.columnName }}
|
{{ column.columnName }}
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
@@ -17,13 +17,13 @@
|
|||||||
<ColumnFormItem
|
<ColumnFormItem
|
||||||
v-model="modelValue[`${column.columnName}`]"
|
v-model="modelValue[`${column.columnName}`]"
|
||||||
:data-type="dbInst.getDialect().getDataType(column.dataType)"
|
:data-type="dbInst.getDialect().getDataType(column.dataType)"
|
||||||
:placeholder="`${column.columnType} ${column.columnComment}`"
|
:placeholder="column?.columnComment ? `${column.columnType} | ${column.columnComment}` : column.columnType"
|
||||||
:column-name="column.columnName"
|
:column-name="column.columnName"
|
||||||
:disabled="column.isIdentity"
|
:disabled="column.isIdentity"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer v-if="props.tableName">
|
||||||
<span class="dialog-footer">
|
<span class="dialog-footer">
|
||||||
<el-button @click="closeDialog">取消</el-button>
|
<el-button @click="closeDialog">取消</el-button>
|
||||||
<el-button type="primary" @click="confirm">确定</el-button>
|
<el-button type="primary" @click="confirm">确定</el-button>
|
||||||
@@ -99,7 +99,7 @@ const confirm = async () => {
|
|||||||
|
|
||||||
let sql = '';
|
let sql = '';
|
||||||
if (oldValue) {
|
if (oldValue) {
|
||||||
const updateColumnValue = {};
|
const updateColumnValue: any = {};
|
||||||
Object.keys(oldValue).forEach((key) => {
|
Object.keys(oldValue).forEach((key) => {
|
||||||
// 如果新旧值不相等,则为需要更新的字段
|
// 如果新旧值不相等,则为需要更新的字段
|
||||||
if (oldValue[key] !== modelValue.value[key]) {
|
if (oldValue[key] !== modelValue.value[key]) {
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ export enum DataType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 列数据类型角标 */
|
/** 列数据类型角标 */
|
||||||
export const ColumnTypeSubscript = {
|
export const ColumnTypeSubscript: any = {
|
||||||
/** 字符串 */
|
/** 字符串 */
|
||||||
string: 'ab',
|
string: 'ab',
|
||||||
/** 数字 */
|
/** 数字 */
|
||||||
|
|||||||
@@ -32,14 +32,14 @@ require (
|
|||||||
github.com/tidwall/gjson v1.17.1
|
github.com/tidwall/gjson v1.17.1
|
||||||
github.com/veops/go-ansiterm v0.0.5
|
github.com/veops/go-ansiterm v0.0.5
|
||||||
go.mongodb.org/mongo-driver v1.16.0 // mongo
|
go.mongodb.org/mongo-driver v1.16.0 // mongo
|
||||||
golang.org/x/crypto v0.24.0 // ssh
|
golang.org/x/crypto v0.25.0 // ssh
|
||||||
golang.org/x/oauth2 v0.21.0
|
golang.org/x/oauth2 v0.21.0
|
||||||
golang.org/x/sync v0.7.0
|
golang.org/x/sync v0.7.0
|
||||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1
|
gopkg.in/natefinch/lumberjack.v2 v2.2.1
|
||||||
gopkg.in/yaml.v3 v3.0.1
|
gopkg.in/yaml.v3 v3.0.1
|
||||||
// gorm
|
// gorm
|
||||||
gorm.io/driver/mysql v1.5.6
|
gorm.io/driver/mysql v1.5.7
|
||||||
gorm.io/gorm v1.25.10
|
gorm.io/gorm v1.25.11
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
@@ -96,7 +96,7 @@ require (
|
|||||||
golang.org/x/exp v0.0.0-20230519143937-03e91628a987 // indirect
|
golang.org/x/exp v0.0.0-20230519143937-03e91628a987 // indirect
|
||||||
golang.org/x/image v0.13.0 // indirect
|
golang.org/x/image v0.13.0 // indirect
|
||||||
golang.org/x/net v0.25.0 // indirect
|
golang.org/x/net v0.25.0 // indirect
|
||||||
golang.org/x/sys v0.21.0 // indirect
|
golang.org/x/sys v0.22.0 // indirect
|
||||||
golang.org/x/text v0.16.0 // indirect
|
golang.org/x/text v0.16.0 // indirect
|
||||||
google.golang.org/genproto v0.0.0-20230131230820-1c016267d619 // indirect
|
google.golang.org/genproto v0.0.0-20230131230820-1c016267d619 // indirect
|
||||||
google.golang.org/grpc v1.52.3 // indirect
|
google.golang.org/grpc v1.52.3 // indirect
|
||||||
|
|||||||
@@ -98,18 +98,19 @@ func NewParserByteStream(width, height int) *ansiterm.ByteStream {
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
enterMarks = [][]byte{
|
enterMarks = [][]byte{
|
||||||
[]byte("\x1b[?1049h"),
|
[]byte("\x1b[?1049h"), // 从备用屏幕缓冲区恢复屏幕内容
|
||||||
[]byte("\x1b[?1048h"),
|
[]byte("\x1b[?1048h"),
|
||||||
[]byte("\x1b[?1047h"),
|
[]byte("\x1b[?1047h"),
|
||||||
[]byte("\x1b[?47h"),
|
[]byte("\x1b[?47h"),
|
||||||
[]byte("\x1b[?25l"),
|
[]byte("\x1b[?25l"), // 隐藏光标
|
||||||
}
|
}
|
||||||
|
|
||||||
exitMarks = [][]byte{
|
exitMarks = [][]byte{
|
||||||
[]byte("\x1b[?1049l"),
|
[]byte("\x1b[?1049l"), // 从备用屏幕缓冲区恢复屏幕内容
|
||||||
[]byte("\x1b[?1048l"),
|
[]byte("\x1b[?1048l"),
|
||||||
[]byte("\x1b[?1047l"),
|
[]byte("\x1b[?1047l"),
|
||||||
[]byte("\x1b[?47l"),
|
[]byte("\x1b[?47l"),
|
||||||
|
[]byte("\x1b[?25h"), // 显示光标
|
||||||
}
|
}
|
||||||
|
|
||||||
screenMarks = [][]byte{
|
screenMarks = [][]byte{
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ func (re *RedisInfo) connSentinel() (*RedisConn, error) {
|
|||||||
SentinelAddrs: strings.Split(masterNameAndHosts[1], ","),
|
SentinelAddrs: strings.Split(masterNameAndHosts[1], ","),
|
||||||
Username: re.Username,
|
Username: re.Username,
|
||||||
Password: re.Password, // no password set
|
Password: re.Password, // no password set
|
||||||
|
SentinelUsername: re.Username,
|
||||||
SentinelPassword: re.Password, // 哨兵节点密码需与redis节点密码一致
|
SentinelPassword: re.Password, // 哨兵节点密码需与redis节点密码一致
|
||||||
DB: re.Db, // use default DB
|
DB: re.Db, // use default DB
|
||||||
DialTimeout: 8 * time.Second,
|
DialTimeout: 8 * time.Second,
|
||||||
|
|||||||
Reference in New Issue
Block a user