|
|
@@ -6,9 +6,12 @@
|
|
|
@change="refreshData" :rowClassName="rowClassName" :dataSource="state.list" :pagination="paginationConfig">
|
|
|
<!-- 操作 -->
|
|
|
<template #action="{ record }">
|
|
|
- <a-tooltip title="查看密码">
|
|
|
+ <a-tooltip title="显示密码" v-if="!record.password">
|
|
|
<EyeOutlined style="color: #2d8cf0;" @click="onClickLookPassword(record.user_id)" />
|
|
|
</a-tooltip>
|
|
|
+ <a-tooltip title="隐藏密码" v-else>
|
|
|
+ <EyeInvisibleOutlined style="color: #2d8cf0;" @click="onClickClosePassword(record.user_id)" />
|
|
|
+ </a-tooltip>
|
|
|
</template>
|
|
|
</a-table>
|
|
|
</div>
|
|
|
@@ -19,7 +22,7 @@
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
import { onMounted, reactive } from 'vue';
|
|
|
-import { EyeOutlined } from '@ant-design/icons-vue';
|
|
|
+import { EyeOutlined, EyeInvisibleOutlined } from '@ant-design/icons-vue';
|
|
|
import Search from './components/Search.vue';
|
|
|
import AddModal from './components/AddModal.vue';
|
|
|
import { getAllUsersInfo } from '/@/api/manage';
|
|
|
@@ -117,9 +120,9 @@ const columns = [
|
|
|
{
|
|
|
title: '密码',
|
|
|
dataIndex: 'password',
|
|
|
- width: 150,
|
|
|
+ width: 100,
|
|
|
customRender: ({ text }: any) => {
|
|
|
- return text || '--';
|
|
|
+ return text || '****';
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
@@ -178,15 +181,26 @@ const onClickReset = async (query: any) => {
|
|
|
const onClickLookPassword = async (id: string) => {
|
|
|
try {
|
|
|
const res = await apis.fetchPilotPassword({ userId: id });
|
|
|
- const item = state.list.find((item) => item.user_id === id);
|
|
|
- if (!item) {
|
|
|
- return;
|
|
|
- }
|
|
|
- item.password = res.data;
|
|
|
+ const list = state.list.map(item => {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ password: item.user_id === id ? res.data : '',// 显示当前密码,关闭其他密码
|
|
|
+ }
|
|
|
+ })
|
|
|
+ state.list = list;
|
|
|
} catch (e) {
|
|
|
console.error(e);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+// 点击关闭密码
|
|
|
+const onClickClosePassword = (id: string) => {
|
|
|
+ const item = state.list.find((item) => item.user_id === id);
|
|
|
+ if (!item) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ item.password = '';
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|