mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-03 16:00:25 +08:00
refactor: 单元格编辑优化
This commit is contained in:
@@ -15,7 +15,7 @@ const config = {
|
|||||||
baseWsUrl: `${(window as any).globalConfig.BaseWsUrl || `${location.protocol == 'https:' ? 'wss:' : 'ws:'}//${getBaseApiUrl()}`}/api`,
|
baseWsUrl: `${(window as any).globalConfig.BaseWsUrl || `${location.protocol == 'https:' ? 'wss:' : 'ws:'}//${getBaseApiUrl()}`}/api`,
|
||||||
|
|
||||||
// 系统版本
|
// 系统版本
|
||||||
version: 'v1.6.1',
|
version: 'v1.6.2',
|
||||||
};
|
};
|
||||||
|
|
||||||
export default config;
|
export default config;
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ body,
|
|||||||
}
|
}
|
||||||
|
|
||||||
.color-success {
|
.color-success {
|
||||||
color: var(--el-color-success) !important;
|
color: var(--el-color-success);
|
||||||
}
|
}
|
||||||
|
|
||||||
.color-warning {
|
.color-warning {
|
||||||
|
|||||||
@@ -3,20 +3,20 @@
|
|||||||
<el-input
|
<el-input
|
||||||
v-if="dataType == DataType.String"
|
v-if="dataType == DataType.String"
|
||||||
:ref="(el: any) => focus && el?.focus()"
|
:ref="(el: any) => focus && el?.focus()"
|
||||||
@blur="handlerBlur"
|
@blur="handleBlur"
|
||||||
class="w100 mb4"
|
:class="`w100 mb4 ${showEditorIcon ? 'string-input-container-show-icon' : ''}`"
|
||||||
input-style="text-align: center; height: 26px;"
|
input-style="text-align: center; height: 26px;"
|
||||||
size="small"
|
size="small"
|
||||||
v-model="itemValue"
|
v-model="itemValue"
|
||||||
:placeholder="placeholder"
|
:placeholder="placeholder"
|
||||||
/>
|
/>
|
||||||
<SvgIcon v-if="showEditorIcon" @mousedown="openEditor" class="string-input-container-icon color-success" name="FullScreen" :size="10" />
|
<SvgIcon v-if="showEditorIcon" @mousedown="openEditor" class="string-input-container-icon" name="FullScreen" :size="10" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-input
|
<el-input
|
||||||
v-else-if="dataType == DataType.Number"
|
v-else-if="dataType == DataType.Number"
|
||||||
:ref="(el: any) => focus && el?.focus()"
|
:ref="(el: any) => focus && el?.focus()"
|
||||||
@blur="handlerBlur"
|
@blur="handleBlur"
|
||||||
class="w100 mb4"
|
class="w100 mb4"
|
||||||
input-style="text-align: center; height: 26px;"
|
input-style="text-align: center; height: 26px;"
|
||||||
size="small"
|
size="small"
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
v-else-if="dataType == DataType.Date"
|
v-else-if="dataType == DataType.Date"
|
||||||
:ref="(el: any) => focus && el?.focus()"
|
:ref="(el: any) => focus && el?.focus()"
|
||||||
@change="emit('blur')"
|
@change="emit('blur')"
|
||||||
@blur="handlerBlur"
|
@blur="handleBlur"
|
||||||
class="edit-time-picker mb4"
|
class="edit-time-picker mb4"
|
||||||
popper-class="edit-time-picker-popper"
|
popper-class="edit-time-picker-popper"
|
||||||
size="small"
|
size="small"
|
||||||
@@ -43,8 +43,8 @@
|
|||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-else-if="dataType == DataType.DateTime"
|
v-else-if="dataType == DataType.DateTime"
|
||||||
:ref="(el: any) => focus && el?.focus()"
|
:ref="(el: any) => focus && el?.focus()"
|
||||||
@change="emit('blur')"
|
@change="handleBlur"
|
||||||
@blur="handlerBlur"
|
@blur="handleBlur"
|
||||||
class="edit-time-picker mb4"
|
class="edit-time-picker mb4"
|
||||||
popper-class="edit-time-picker-popper"
|
popper-class="edit-time-picker-popper"
|
||||||
size="small"
|
size="small"
|
||||||
@@ -58,8 +58,8 @@
|
|||||||
<el-time-picker
|
<el-time-picker
|
||||||
v-else-if="dataType == DataType.Time"
|
v-else-if="dataType == DataType.Time"
|
||||||
:ref="(el: any) => focus && el?.focus()"
|
:ref="(el: any) => focus && el?.focus()"
|
||||||
@change="emit('blur')"
|
@change="handleBlur"
|
||||||
@blur="handlerBlur"
|
@blur="handleBlur"
|
||||||
class="edit-time-picker mb4"
|
class="edit-time-picker mb4"
|
||||||
popper-class="edit-time-picker-popper"
|
popper-class="edit-time-picker-popper"
|
||||||
size="small"
|
size="small"
|
||||||
@@ -74,7 +74,6 @@
|
|||||||
import { Ref, ref, computed } from 'vue';
|
import { Ref, ref, computed } from 'vue';
|
||||||
import { ElInput } from 'element-plus';
|
import { ElInput } from 'element-plus';
|
||||||
import { DataType } from '../../dialect/index';
|
import { DataType } from '../../dialect/index';
|
||||||
import { useVModel } from '@vueuse/core';
|
|
||||||
import SvgIcon from '@/components/svgIcon/index.vue';
|
import SvgIcon from '@/components/svgIcon/index.vue';
|
||||||
import MonacoEditorDialog from '@/components/monaco/MonacoEditorDialog';
|
import MonacoEditorDialog from '@/components/monaco/MonacoEditorDialog';
|
||||||
|
|
||||||
@@ -93,7 +92,7 @@ const props = withDefaults(defineProps<ColumnFormItemProps>(), {
|
|||||||
|
|
||||||
const emit = defineEmits(['update:modelValue', 'blur']);
|
const emit = defineEmits(['update:modelValue', 'blur']);
|
||||||
|
|
||||||
const itemValue: Ref<any> = useVModel(props, 'modelValue', emit);
|
const itemValue: Ref<any> = ref(props.modelValue);
|
||||||
|
|
||||||
const showEditorIcon = computed(() => {
|
const showEditorIcon = computed(() => {
|
||||||
return typeof itemValue.value === 'string' && itemValue.value.length > 50;
|
return typeof itemValue.value === 'string' && itemValue.value.length > 50;
|
||||||
@@ -119,13 +118,14 @@ const openEditor = () => {
|
|||||||
|
|
||||||
const closeEditorDialog = () => {
|
const closeEditorDialog = () => {
|
||||||
editorOpening.value = false;
|
editorOpening.value = false;
|
||||||
handlerBlur();
|
handleBlur();
|
||||||
};
|
};
|
||||||
|
|
||||||
const handlerBlur = () => {
|
const handleBlur = () => {
|
||||||
if (editorOpening.value) {
|
if (editorOpening.value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
emit('update:modelValue', itemValue.value);
|
||||||
emit('blur');
|
emit('blur');
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -157,10 +157,19 @@ const getEditorLangByValue = (value: any) => {
|
|||||||
.string-input-container {
|
.string-input-container {
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
.string-input-container-show-icon {
|
||||||
|
.el-input__inner {
|
||||||
|
padding-right: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
.string-input-container-icon {
|
.string-input-container-icon {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 5px; /* 调整图标的垂直位置 */
|
top: 5px; /* 调整图标的垂直位置 */
|
||||||
right: 5px; /* 调整图标的水平位置 */
|
right: 3px; /* 调整图标的水平位置 */
|
||||||
|
color: var(--el-color-primary);
|
||||||
|
}
|
||||||
|
.string-input-container-icon:hover {
|
||||||
|
color: var(--el-color-success);
|
||||||
}
|
}
|
||||||
|
|
||||||
.edit-time-picker {
|
.edit-time-picker {
|
||||||
|
|||||||
@@ -657,6 +657,9 @@ const onEnterEditMode = (rowData: any, column: any, rowIndex = 0, columnIndex =
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onExitEditMode = (rowData: any, column: any, rowIndex = 0) => {
|
const onExitEditMode = (rowData: any, column: any, rowIndex = 0) => {
|
||||||
|
if (!nowUpdateCell) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const oldValue = nowUpdateCell.oldValue;
|
const oldValue = nowUpdateCell.oldValue;
|
||||||
const newValue = rowData[column.dataKey];
|
const newValue = rowData[column.dataKey];
|
||||||
|
|
||||||
@@ -763,9 +766,6 @@ const rowClass = (row: any) => {
|
|||||||
if (isSelection(row.rowIndex)) {
|
if (isSelection(row.rowIndex)) {
|
||||||
return 'data-selection';
|
return 'data-selection';
|
||||||
}
|
}
|
||||||
if (row.rowIndex % 2 != 0) {
|
|
||||||
return 'data-spacing';
|
|
||||||
}
|
|
||||||
return '';
|
return '';
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -837,10 +837,6 @@ defineExpose({
|
|||||||
background-color: var(--el-table-current-row-bg-color);
|
background-color: var(--el-table-current-row-bg-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
.data-spacing {
|
|
||||||
background-color: var(--el-fill-color-lighter);
|
|
||||||
}
|
|
||||||
|
|
||||||
.update_field_active {
|
.update_field_active {
|
||||||
background-color: var(--el-color-success-light-3);
|
background-color: var(--el-color-success-light-3);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,7 +94,7 @@
|
|||||||
<template #prepend>
|
<template #prepend>
|
||||||
<el-popover :visible="state.condPopVisible" trigger="click" :width="320" placement="right">
|
<el-popover :visible="state.condPopVisible" trigger="click" :width="320" placement="right">
|
||||||
<template #reference>
|
<template #reference>
|
||||||
<el-button @click.stop="chooseCondColumnName" class="color-success" text size="small">选择列</el-button>
|
<el-button @click.stop="chooseCondColumnName" style="color: var(--el-color-success)" text size="small">选择列</el-button>
|
||||||
</template>
|
</template>
|
||||||
<el-table
|
<el-table
|
||||||
:data="filterCondColumns"
|
:data="filterCondColumns"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import "fmt"
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
AppName = "mayfly-go"
|
AppName = "mayfly-go"
|
||||||
Version = "v1.6.1"
|
Version = "v1.6.2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetAppInfo() string {
|
func GetAppInfo() string {
|
||||||
|
|||||||
Reference in New Issue
Block a user