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"
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'
303350import UserImport from ' ./UserImport.vue'
304351import SuccessFilled from ' @/assets/svg/gou_icon.svg'
305352import CircleCloseFilled from ' @/assets/svg/icon_ban_filled.svg'
@@ -317,6 +364,8 @@ import icon_add_outlined from '@/assets/svg/icon_add_outlined.svg'
317364import { userApi } from ' @/api/user'
318365import { workspaceList } from ' @/api/workspace'
319366import { 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
321370const { t } = useI18n ()
322371const 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+
431508const multipleTableRef = ref ()
432509const multipleSelectionAll = ref <any []>([])
433510const 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