Skip to content

Commit 97dde02

Browse files
committed
fix: bug fix
1 parent 9098f5b commit 97dde02

File tree

4 files changed

+139
-2
lines changed

4 files changed

+139
-2
lines changed
Lines changed: 5 additions & 0 deletions
Loading

frontend/src/i18n/en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,8 @@
224224
"custom_notes": "Custom notes",
225225
"field_type": "Field type",
226226
"field_name": "Field name",
227+
"copy": "Copy",
228+
"the_original_one": "Are you sure you want to restore the password to the original one?",
227229
"relevant_content_found": "No relevant content found",
228230
"please_enter": "Please enter",
229231
"Please_select": "Please select",

frontend/src/i18n/zh-CN.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,8 @@
223223
"edit": "编辑",
224224
"source_connection_failed": "数据源连接失败",
225225
"confirm": "确定",
226+
"copy": "复制",
227+
"the_original_one": "确认恢复为初始密码吗?",
226228
"enabled_status": "启用状态",
227229
"custom_notes": "自定义备注",
228230
"field_type": "字段类型",

frontend/src/views/system/user/User.vue

Lines changed: 130 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,57 @@
110110
:content="$t('common.reset_password')"
111111
placement="top"
112112
>
113-
<el-icon class="action-btn" size="16" @click="handleEditPassword(scope.row.id)">
113+
<el-icon
114+
:ref="
115+
(el: any) => {
116+
setButtonRef(el, scope.row)
117+
}
118+
"
119+
v-click-outside="onClickOutside(scope.row)"
120+
class="action-btn"
121+
size="16"
122+
>
114123
<IconLock></IconLock>
115124
</el-icon>
116125
</el-tooltip>
126+
<el-popover
127+
placement="right"
128+
virtual-triggering
129+
:width="300"
130+
:virtual-ref="scope.row.buttonRef"
131+
trigger="click"
132+
show-arrow
133+
:ref="
134+
(el: any) => {
135+
setPopoverRef(el, scope.row)
136+
}
137+
"
138+
>
139+
<div class="reset-pwd-confirm">
140+
<div class="confirm-header">
141+
<span class="icon-span">
142+
<el-icon size="24">
143+
<icon_warning_filled class="svg-icon" />
144+
</el-icon>
145+
</span>
146+
<span class="header-span">{{ t('datasource.the_original_one') }}</span>
147+
</div>
148+
<div class="confirm-content">
149+
<span>SQLBot@123456</span>
150+
<el-button @click="copyText" style="margin-left: 4px" text>{{
151+
t('datasource.copy')
152+
}}</el-button>
153+
</div>
154+
<div class="confirm-foot">
155+
<el-button secondary @click="closeResetInfo(scope.row)">{{
156+
t('common.cancel')
157+
}}</el-button>
158+
<el-button type="primary" @click="handleEditPassword(scope.row.id)">
159+
{{ t('datasource.confirm') }}
160+
</el-button>
161+
</div>
162+
</div>
163+
</el-popover>
117164

118165
<el-tooltip
119166
:offset="14"
@@ -299,7 +346,7 @@
299346
</template>
300347

301348
<script setup lang="ts">
302-
import { ref, reactive, onMounted, nextTick } from 'vue'
349+
import { ref, unref, reactive, onMounted, nextTick } from 'vue'
303350
import UserImport from './UserImport.vue'
304351
import SuccessFilled from '@/assets/svg/gou_icon.svg'
305352
import CircleCloseFilled from '@/assets/svg/icon_ban_filled.svg'
@@ -317,6 +364,8 @@ import icon_add_outlined from '@/assets/svg/icon_add_outlined.svg'
317364
import { userApi } from '@/api/user'
318365
import { workspaceList } from '@/api/workspace'
319366
import { formatTimestamp } from '@/utils/date'
367+
import { ClickOutside as vClickOutside } from 'element-plus-secondary'
368+
import icon_warning_filled from '@/assets/svg/icon_warning_filled.svg'
320369
321370
const { t } = useI18n()
322371
const keyword = ref('')
@@ -428,6 +477,34 @@ const passwordRules = {
428477
],
429478
}
430479
480+
const closeResetInfo = (row: any) => {
481+
row.popoverRef?.hide()
482+
row.resetInfoShow = false
483+
}
484+
const setPopoverRef = (el: any, row: any) => {
485+
row.popoverRef = el
486+
}
487+
488+
const copyText = () => {
489+
navigator.clipboard
490+
.writeText('SQLBot@123456')
491+
.then(function () {
492+
ElMessage.success(t('embedded.copy_successful'))
493+
})
494+
.catch(function () {
495+
ElMessage.error(t('embedded.copy_successful'))
496+
})
497+
}
498+
499+
const setButtonRef = (el: any, row: any) => {
500+
row.buttonRef = el
501+
}
502+
const onClickOutside = (row: any) => {
503+
if (row.popoverRef) {
504+
unref(row.popoverRef).popperRef?.delayHide?.()
505+
}
506+
}
507+
431508
const multipleTableRef = ref()
432509
const multipleSelectionAll = ref<any[]>([])
433510
const dialogTitle = ref('')
@@ -862,3 +939,54 @@ onMounted(() => {
862939
}
863940
}
864941
</style>
942+
943+
<style lang="less">
944+
.reset-pwd-confirm {
945+
padding: 5px 15px;
946+
.confirm-header {
947+
width: 100%;
948+
min-height: 40px;
949+
line-height: 40px;
950+
display: flex;
951+
flex-direction: row;
952+
.icon-span {
953+
color: var(--ed-color-warning);
954+
font-size: 22px;
955+
i {
956+
top: 3px;
957+
}
958+
}
959+
.header-span {
960+
font-size: 16px;
961+
font-weight: bold;
962+
margin-left: 10px;
963+
white-space: pre-wrap;
964+
word-break: keep-all;
965+
}
966+
}
967+
.confirm-foot {
968+
padding: 0;
969+
display: flex;
970+
flex-wrap: wrap;
971+
justify-content: flex-end;
972+
align-items: center;
973+
margin-top: 15px;
974+
.ed-button {
975+
min-width: 48px;
976+
height: 28px;
977+
line-height: 28px;
978+
font-size: 12px;
979+
}
980+
}
981+
.confirm-warning {
982+
font-size: 12px;
983+
color: var(--ed-color-danger);
984+
margin-left: 33px;
985+
}
986+
.confirm-content {
987+
margin-left: 33px;
988+
display: flex;
989+
align-items: center;
990+
}
991+
}
992+
</style>

0 commit comments

Comments
 (0)