|
|
@@ -3,35 +3,52 @@
|
|
|
<Search :onClickAddUser="onClickAddUser" :onClickSearch="onClickSearch" :onClickReset="onClickReset" />
|
|
|
<div class="mediaList-table">
|
|
|
<a-table :scroll="{ x: '100%', y: 500 }" rowKey="user_id" :loading="state.listLoading" :columns="columns"
|
|
|
- @change="refreshData" :rowClassName="rowClassName" :dataSource="state.list" :pagination="paginationConfig" />
|
|
|
+ @change="refreshData" :rowClassName="rowClassName" :dataSource="state.list" :pagination="paginationConfig">
|
|
|
+ <!-- 操作 -->
|
|
|
+ <template #action="{ record }">
|
|
|
+ <a-tooltip title="查看密码">
|
|
|
+ <EyeOutlined style="color: #2d8cf0;" @click="onClickLookPassword(record.user_id)" />
|
|
|
+ </a-tooltip>
|
|
|
+ </template>
|
|
|
+ </a-table>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <AddModal :visible="state.visible" :onClickConfirm="addModalOnClickConfirm" :onClickCancel="addModalOnClickCancel"
|
|
|
+ v-if="state.visible" />
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import { onMounted, reactive } from 'vue'
|
|
|
+import { onMounted, reactive } from 'vue';
|
|
|
+import { EyeOutlined } from '@ant-design/icons-vue';
|
|
|
import Search from './components/Search.vue';
|
|
|
-import { getAllUsersInfo } from '/@/api/manage'
|
|
|
-import { ELocalStorageKey } from '/@/types'
|
|
|
+import AddModal from './components/AddModal.vue';
|
|
|
+import { getAllUsersInfo } from '/@/api/manage';
|
|
|
+import { apis } from '/@/api/custom/index';
|
|
|
+import { ELocalStorageKey } from '/@/types';
|
|
|
|
|
|
export interface Member {
|
|
|
- user_id: string
|
|
|
- username: string
|
|
|
- user_type: string
|
|
|
- workspace_name: string
|
|
|
- create_time: string
|
|
|
- mqtt_username: string
|
|
|
- mqtt_password: string
|
|
|
+ user_id: string,
|
|
|
+ username: string,
|
|
|
+ user_type: string,
|
|
|
+ workspace_name: string,
|
|
|
+ create_time: string,
|
|
|
+ mqtt_username: string,
|
|
|
+ mqtt_password: string,
|
|
|
+ password: string,
|
|
|
}
|
|
|
|
|
|
interface State {
|
|
|
+ query: any,
|
|
|
listLoading: boolean,
|
|
|
list: Member[],
|
|
|
+ visible: boolean,
|
|
|
}
|
|
|
|
|
|
const state: State = reactive({
|
|
|
+ query: undefined,
|
|
|
listLoading: false,
|
|
|
list: [],
|
|
|
+ visible: false,
|
|
|
})
|
|
|
|
|
|
const paginationConfig = reactive({
|
|
|
@@ -78,6 +95,13 @@ const columns = [
|
|
|
title: '用户类型',
|
|
|
dataIndex: 'user_type',
|
|
|
width: 150,
|
|
|
+ customRender: ({ text }: any) => {
|
|
|
+ if (text === 'Web') {
|
|
|
+ return '管理员'
|
|
|
+ } else {
|
|
|
+ return '飞行员'
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
{
|
|
|
title: '项目名称',
|
|
|
@@ -89,7 +113,23 @@ const columns = [
|
|
|
dataIndex: 'create_time',
|
|
|
width: 150,
|
|
|
sorter: (a: Member, b: Member) => a.create_time.localeCompare(b.create_time),
|
|
|
- }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '密码',
|
|
|
+ dataIndex: 'password',
|
|
|
+ width: 150,
|
|
|
+ customRender: ({ text }: any) => {
|
|
|
+ return text || '--';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '操作',
|
|
|
+ dataIndex: 'actions',
|
|
|
+ fixed: 'right',
|
|
|
+ align: 'center',
|
|
|
+ width: 60,
|
|
|
+ slots: { customRender: 'action' },
|
|
|
+ },
|
|
|
]
|
|
|
|
|
|
const rowClassName = (record: any, index: number) => {
|
|
|
@@ -106,13 +146,26 @@ const refreshData = async (page: any) => {
|
|
|
await fetchList();
|
|
|
}
|
|
|
|
|
|
-// 点击添加用户
|
|
|
+// 点击添加飞行员
|
|
|
const onClickAddUser = () => {
|
|
|
+ state.visible = true;
|
|
|
+}
|
|
|
|
|
|
+// 添加飞行员弹出层-点击确定
|
|
|
+const addModalOnClickConfirm = async (data: any) => {
|
|
|
+ state.visible = false;
|
|
|
+ await apis.AddPilot(data);
|
|
|
+ await fetchList(state.query)
|
|
|
+}
|
|
|
+
|
|
|
+// 添加飞行员弹出层-点击取消
|
|
|
+const addModalOnClickCancel = () => {
|
|
|
+ state.visible = false;
|
|
|
}
|
|
|
|
|
|
// 点击搜索
|
|
|
const onClickSearch = async (query: any) => {
|
|
|
+ state.query = query;
|
|
|
await fetchList(query);
|
|
|
}
|
|
|
|
|
|
@@ -120,6 +173,20 @@ const onClickSearch = async (query: any) => {
|
|
|
const onClickReset = async (query: any) => {
|
|
|
await fetchList(query);
|
|
|
}
|
|
|
+
|
|
|
+// 点击查看密码
|
|
|
+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;
|
|
|
+ } catch (e) {
|
|
|
+ console.error(e);
|
|
|
+ }
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|