修复已知bug
This commit is contained in:
@@ -1,2 +1,3 @@
|
|||||||
VITE_APP_NAME=后台管理(开发环境)
|
VITE_APP_NAME=后台管理(开发环境)
|
||||||
#VITE_API_URL=http://127.0.0.1:9200/api
|
#VITE_API_URL=http://127.0.0.1:9200/api
|
||||||
|
#VITE_SERVER_API_URL=http://127.0.0.1:8000/api
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export async function addAccessKey(data: AccessKey) {
|
|||||||
data
|
data
|
||||||
);
|
);
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
return res.data.message;
|
return res.data.data;
|
||||||
}
|
}
|
||||||
return Promise.reject(new Error(res.data.message));
|
return Promise.reject(new Error(res.data.message));
|
||||||
}
|
}
|
||||||
|
|||||||
368
src/views/shop/shopAdmin/components/admin.vue
Normal file
368
src/views/shop/shopAdmin/components/admin.vue
Normal file
@@ -0,0 +1,368 @@
|
|||||||
|
<template>
|
||||||
|
|
||||||
|
<!-- 表格 -->
|
||||||
|
<ele-pro-table
|
||||||
|
ref="tableRef"
|
||||||
|
row-key="userId"
|
||||||
|
:columns="columns"
|
||||||
|
:datasource="datasource"
|
||||||
|
:where="defaultWhere"
|
||||||
|
:toolbar="false"
|
||||||
|
:needPage="false"
|
||||||
|
cache-key="proSystemUserTable"
|
||||||
|
>
|
||||||
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="column.key === 'avatar'">
|
||||||
|
<a-avatar
|
||||||
|
:size="30"
|
||||||
|
:src="`${record.avatar}`"
|
||||||
|
style="margin-right: 4px"
|
||||||
|
>
|
||||||
|
<template #icon>
|
||||||
|
<UserOutlined/>
|
||||||
|
</template>
|
||||||
|
</a-avatar>
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'nickname'">
|
||||||
|
<span>{{ record.nickname }}</span>
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'mobile'">
|
||||||
|
<span v-if="hasRole('superAdmin')">{{ record.phone }}</span>
|
||||||
|
<span v-else>{{ record.mobile }}</span>
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'roles'">
|
||||||
|
<a-tag v-for="item in record.roles" :key="item.roleId" color="blue">
|
||||||
|
{{ item.roleName }}
|
||||||
|
</a-tag>
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'platform'">
|
||||||
|
<WechatOutlined v-if="record.platform === 'MP-WEIXIN'"/>
|
||||||
|
<Html5Outlined v-if="record.platform === 'H5'"/>
|
||||||
|
<ChromeOutlined v-if="record.platform === 'WEB'"/>
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'balance'">
|
||||||
|
<span class="ele-text-success">
|
||||||
|
¥{{ formatNumber(record.balance) }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'expendMoney'">
|
||||||
|
<span class="ele-text-warning">
|
||||||
|
¥{{ formatNumber(record.expendMoney) }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'isAdmin'">
|
||||||
|
<a-tag v-if="record.isAdmin">是</a-tag>
|
||||||
|
<a-tag v-else>否</a-tag>
|
||||||
|
<!-- <a-switch-->
|
||||||
|
<!-- :checked="record.isAdmin == 1"-->
|
||||||
|
<!-- @change="updateIsAdmin(record)"-->
|
||||||
|
<!-- />-->
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'action'">
|
||||||
|
<div>
|
||||||
|
<a @click="openEdit(record)">修改</a>
|
||||||
|
<a-divider type="vertical"/>
|
||||||
|
<!-- <a @click="resetPsw(record)">重置</a>-->
|
||||||
|
<!-- <a-divider type="vertical" />-->
|
||||||
|
<a-popconfirm
|
||||||
|
placement="topRight"
|
||||||
|
title="确定要删除此用户吗?"
|
||||||
|
@confirm="remove(record)"
|
||||||
|
>
|
||||||
|
<a class="ele-text-danger">删除</a>
|
||||||
|
</a-popconfirm>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</ele-pro-table>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import {createVNode, ref, reactive} from 'vue';
|
||||||
|
import {message, Modal} from 'ant-design-vue/es';
|
||||||
|
import {
|
||||||
|
PlusOutlined,
|
||||||
|
DeleteOutlined,
|
||||||
|
UploadOutlined,
|
||||||
|
EditOutlined,
|
||||||
|
UserOutlined,
|
||||||
|
Html5Outlined,
|
||||||
|
ChromeOutlined,
|
||||||
|
WechatOutlined,
|
||||||
|
ExclamationCircleOutlined
|
||||||
|
} from '@ant-design/icons-vue';
|
||||||
|
import type {EleProTable} from 'ele-admin-pro/es';
|
||||||
|
import type {
|
||||||
|
DatasourceFunction,
|
||||||
|
ColumnItem
|
||||||
|
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||||
|
import {messageLoading, formatNumber} from 'ele-admin-pro/es';
|
||||||
|
import UserEdit from './components/user-edit.vue';
|
||||||
|
import UserImport from './components/user-import.vue';
|
||||||
|
import UserInfo from './components/user-info.vue';
|
||||||
|
import {toDateString} from 'ele-admin-pro';
|
||||||
|
import {
|
||||||
|
pageUsers,
|
||||||
|
removeUser,
|
||||||
|
removeUsers,
|
||||||
|
updateUserPassword,
|
||||||
|
updateUser
|
||||||
|
} from '@/api/system/user';
|
||||||
|
import type {User, UserParam} from '@/api/system/user/model';
|
||||||
|
import {toTreeData, uuid} from 'ele-admin-pro';
|
||||||
|
import {listRoles} from '@/api/system/role';
|
||||||
|
import {listOrganizations} from '@/api/system/organization';
|
||||||
|
import {Organization} from '@/api/system/organization/model';
|
||||||
|
import {hasRole} from '@/utils/permission';
|
||||||
|
import {getPageTitle} from "@/utils/common";
|
||||||
|
import Extra from "./components/Extra.vue";
|
||||||
|
|
||||||
|
// 加载状态
|
||||||
|
const loading = ref(true);
|
||||||
|
// 树形数据
|
||||||
|
const data = ref<Organization[]>([]);
|
||||||
|
// 树展开的key
|
||||||
|
const expandedRowKeys = ref<number[]>([]);
|
||||||
|
// 树选中的key
|
||||||
|
const selectedRowKeys = ref<number[]>([]);
|
||||||
|
// 表格选中数据
|
||||||
|
const selection = ref<User[]>([]);
|
||||||
|
// 当前编辑数据
|
||||||
|
const current = ref<User | null>(null);
|
||||||
|
// 是否显示编辑弹窗
|
||||||
|
const showEdit = ref(false);
|
||||||
|
// 是否显示用户详情
|
||||||
|
const showInfo = ref(false);
|
||||||
|
// 是否显示用户导入弹窗
|
||||||
|
const showImport = ref(false);
|
||||||
|
const userType = ref<number>();
|
||||||
|
const searchText = ref('');
|
||||||
|
|
||||||
|
// 加载角色
|
||||||
|
const roles = ref<any[]>([]);
|
||||||
|
const filters = () => {
|
||||||
|
listRoles().then((result) => {
|
||||||
|
result.map((d) => {
|
||||||
|
roles.value.push({
|
||||||
|
text: d.roleName,
|
||||||
|
value: d.roleId
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
filters();
|
||||||
|
// 加载机构
|
||||||
|
listOrganizations()
|
||||||
|
.then((list) => {
|
||||||
|
loading.value = false;
|
||||||
|
const eks: number[] = [];
|
||||||
|
list.forEach((d) => {
|
||||||
|
d.key = d.organizationId;
|
||||||
|
d.value = d.organizationId;
|
||||||
|
d.title = d.organizationName;
|
||||||
|
if (typeof d.key === 'number') {
|
||||||
|
eks.push(d.key);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
expandedRowKeys.value = eks;
|
||||||
|
data.value = toTreeData({
|
||||||
|
data: list,
|
||||||
|
idField: 'organizationId',
|
||||||
|
parentIdField: 'parentId'
|
||||||
|
});
|
||||||
|
if (list.length) {
|
||||||
|
if (typeof list[0].key === 'number') {
|
||||||
|
selectedRowKeys.value = [list[0].key];
|
||||||
|
}
|
||||||
|
// current.value = list[0];
|
||||||
|
} else {
|
||||||
|
selectedRowKeys.value = [];
|
||||||
|
// current.value = null;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
loading.value = false;
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 表格实例
|
||||||
|
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||||
|
// 表格列配置
|
||||||
|
const columns = ref<ColumnItem[]>([
|
||||||
|
{
|
||||||
|
title: 'ID',
|
||||||
|
dataIndex: 'userId',
|
||||||
|
width: 90,
|
||||||
|
showSorterTooltip: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '头像',
|
||||||
|
key: 'avatar',
|
||||||
|
dataIndex: 'avatar',
|
||||||
|
align: 'center',
|
||||||
|
width: 90
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '手机号码',
|
||||||
|
dataIndex: 'mobile',
|
||||||
|
align: 'center',
|
||||||
|
key: 'mobile',
|
||||||
|
showSorterTooltip: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '注册时间',
|
||||||
|
dataIndex: 'createTime',
|
||||||
|
sorter: true,
|
||||||
|
showSorterTooltip: false,
|
||||||
|
ellipsis: true,
|
||||||
|
customRender: ({text}) => toDateString(text, 'yyyy-MM-dd')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
key: 'action',
|
||||||
|
width: 120,
|
||||||
|
fixed: 'right',
|
||||||
|
align: 'center'
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
// 默认搜索条件
|
||||||
|
const defaultWhere = reactive({
|
||||||
|
username: '',
|
||||||
|
nickname: ''
|
||||||
|
});
|
||||||
|
|
||||||
|
// 表格数据源
|
||||||
|
const datasource: DatasourceFunction = ({
|
||||||
|
page,
|
||||||
|
limit,
|
||||||
|
where,
|
||||||
|
orders,
|
||||||
|
filters
|
||||||
|
}) => {
|
||||||
|
where = {};
|
||||||
|
where.roleId = filters.roles;
|
||||||
|
where.keywords = searchText.value;
|
||||||
|
where.isAdmin = 1;
|
||||||
|
return pageUsers({page, limit, ...where, ...orders});
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 搜索 */
|
||||||
|
const reload = (where?: UserParam) => {
|
||||||
|
selection.value = [];
|
||||||
|
tableRef?.value?.reload({where});
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 打开编辑弹窗 */
|
||||||
|
const openEdit = (row?: User) => {
|
||||||
|
current.value = row ?? null;
|
||||||
|
showEdit.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 打开用户详情弹窗 */
|
||||||
|
const openInfo = (row?: User) => {
|
||||||
|
current.value = row ?? null;
|
||||||
|
showInfo.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 打开编辑弹窗 */
|
||||||
|
const openImport = () => {
|
||||||
|
showImport.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleTabs = (e) => {
|
||||||
|
userType.value = Number(e.target.value);
|
||||||
|
reload();
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 删除单个 */
|
||||||
|
const remove = (row: User) => {
|
||||||
|
const hide = messageLoading('请求中..', 0);
|
||||||
|
removeUser(row.userId)
|
||||||
|
.then((msg) => {
|
||||||
|
hide();
|
||||||
|
message.success(msg);
|
||||||
|
reload();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
hide();
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 批量删除 */
|
||||||
|
const removeBatch = () => {
|
||||||
|
if (!selection.value.length) {
|
||||||
|
message.error('请至少选择一条数据');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Modal.confirm({
|
||||||
|
title: '提示',
|
||||||
|
content: '确定要删除选中的用户吗?',
|
||||||
|
icon: createVNode(ExclamationCircleOutlined),
|
||||||
|
maskClosable: true,
|
||||||
|
onOk: () => {
|
||||||
|
const hide = messageLoading('请求中..', 0);
|
||||||
|
removeUsers(selection.value.map((d) => d.userId))
|
||||||
|
.then((msg) => {
|
||||||
|
hide();
|
||||||
|
message.success(msg);
|
||||||
|
reload();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
hide();
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 重置用户密码 */
|
||||||
|
const resetPsw = (row: User) => {
|
||||||
|
Modal.confirm({
|
||||||
|
title: '提示',
|
||||||
|
content: '确定要重置此用户的密码吗?',
|
||||||
|
icon: createVNode(ExclamationCircleOutlined),
|
||||||
|
maskClosable: true,
|
||||||
|
onOk: () => {
|
||||||
|
const hide = message.loading('请求中..', 0);
|
||||||
|
const password = uuid(8);
|
||||||
|
updateUserPassword(row.userId, password)
|
||||||
|
.then((msg) => {
|
||||||
|
hide();
|
||||||
|
message.success(msg + ',新密码:' + password);
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
hide();
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 修改用户状态 */
|
||||||
|
const updateIsAdmin = (row: User) => {
|
||||||
|
row.isAdmin = !row.isAdmin;
|
||||||
|
updateUser(row)
|
||||||
|
.then((msg) => {
|
||||||
|
message.success(msg);
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 自定义行属性 */
|
||||||
|
const customRow = (record: User) => {
|
||||||
|
return {
|
||||||
|
// 行点击事件
|
||||||
|
onClick: () => {
|
||||||
|
// console.log(record);
|
||||||
|
},
|
||||||
|
// 行双击事件
|
||||||
|
onDblclick: () => {
|
||||||
|
openEdit(record);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
</script>
|
||||||
51
src/views/shop/shopAdmin/components/role.vue
Normal file
51
src/views/shop/shopAdmin/components/role.vue
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
<template>
|
||||||
|
<a-table :dataSource="dataSource" :columns="columns" :pagination="false">
|
||||||
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="column.key === 'name'">
|
||||||
|
<div class="flex">
|
||||||
|
<span class="w-32">{{ record.name }}</span>
|
||||||
|
<span class="w-32">{{ record.value }}</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'action'">
|
||||||
|
<template v-if="record.key === '2'">
|
||||||
|
<a-button>重置</a-button>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</a-table>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
setup() {
|
||||||
|
return {
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
title: '开发者ID',
|
||||||
|
dataIndex: 'name',
|
||||||
|
key: 'name',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
dataIndex: 'action',
|
||||||
|
key: 'action',
|
||||||
|
align: 'center',
|
||||||
|
width: 240,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
dataSource: [
|
||||||
|
{
|
||||||
|
key: '1',
|
||||||
|
name: '租户ID',
|
||||||
|
value: '10550'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: '2',
|
||||||
|
name: 'AppSecret',
|
||||||
|
value: 'sdfsdfsdfsdfs'
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
@@ -1,130 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="ele-body">
|
|
||||||
<a-card title="基本信息" :bordered="false">
|
|
||||||
<a-form
|
|
||||||
class="ele-form-detail"
|
|
||||||
:label-col="
|
|
||||||
styleResponsive ? { md: 2, sm: 4, xs: 6 } : { flex: '90px' }
|
|
||||||
"
|
|
||||||
:wrapper-col="
|
|
||||||
styleResponsive ? { md: 22, sm: 20, xs: 18 } : { flex: '1' }
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<a-form-item label="账号">
|
|
||||||
<div class="ele-text-secondary">{{ form.username }}</div>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="昵称">
|
|
||||||
<div class="ele-text-secondary">{{ form.nickname }}</div>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="性别">
|
|
||||||
<div class="ele-text-secondary">{{ form.sexName }}</div>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="手机号">
|
|
||||||
<div class="ele-text-secondary">{{ form.phone }}</div>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="真实姓名">
|
|
||||||
<div class="ele-text-secondary">{{ form.realName }}</div>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="别名">
|
|
||||||
<div class="ele-text-secondary">{{ form.alias }}</div>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="角色">
|
|
||||||
<a-tag v-for="item in form.roles" :key="item.roleId" color="blue">
|
|
||||||
{{ item.roleName }}
|
|
||||||
</a-tag>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="创建时间">
|
|
||||||
<div class="ele-text-secondary">{{ form.createTime }}</div>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="状态">
|
|
||||||
<a-badge
|
|
||||||
v-if="typeof form.status === 'number'"
|
|
||||||
:status="(['processing', 'error'][form.status] as any)"
|
|
||||||
:text="['正常', '冻结'][form.status]"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
</a-form>
|
|
||||||
</a-card>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { ref, watch, unref } from 'vue';
|
|
||||||
import { useRouter } from 'vue-router';
|
|
||||||
import { message } from 'ant-design-vue/es';
|
|
||||||
import { toDateString } from 'ele-admin-pro/es';
|
|
||||||
import { storeToRefs } from 'pinia';
|
|
||||||
import { useThemeStore } from '@/store/modules/theme';
|
|
||||||
import useFormData from '@/utils/use-form-data';
|
|
||||||
import { setPageTabTitle } from '@/utils/page-tab-util';
|
|
||||||
import { getUser } from '@/api/system/user';
|
|
||||||
import type { User } from '@/api/system/user/model';
|
|
||||||
const ROUTE_PATH = '/system/user/details';
|
|
||||||
|
|
||||||
// 是否开启响应式布局
|
|
||||||
const themeStore = useThemeStore();
|
|
||||||
const { styleResponsive } = storeToRefs(themeStore);
|
|
||||||
|
|
||||||
const { currentRoute } = useRouter();
|
|
||||||
|
|
||||||
// 用户信息
|
|
||||||
const { form, assignFields } = useFormData<User>({
|
|
||||||
userId: undefined,
|
|
||||||
alias: '',
|
|
||||||
realName: '',
|
|
||||||
username: '',
|
|
||||||
nickname: '',
|
|
||||||
sexName: '',
|
|
||||||
phone: '',
|
|
||||||
roles: [],
|
|
||||||
createTime: undefined,
|
|
||||||
status: undefined
|
|
||||||
});
|
|
||||||
|
|
||||||
// 请求状态
|
|
||||||
const loading = ref(true);
|
|
||||||
|
|
||||||
/* */
|
|
||||||
const query = () => {
|
|
||||||
const { query } = unref(currentRoute);
|
|
||||||
const id = query.id;
|
|
||||||
if (!id || form.userId === Number(id)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
loading.value = true;
|
|
||||||
getUser(Number(id))
|
|
||||||
.then((data) => {
|
|
||||||
loading.value = false;
|
|
||||||
assignFields({
|
|
||||||
...data,
|
|
||||||
createTime: toDateString(data.createTime)
|
|
||||||
});
|
|
||||||
// 修改页签标题
|
|
||||||
if (unref(currentRoute).path === ROUTE_PATH) {
|
|
||||||
setPageTabTitle(data.nickname + '的信息');
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
loading.value = false;
|
|
||||||
message.error(e.message);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
watch(
|
|
||||||
currentRoute,
|
|
||||||
(route) => {
|
|
||||||
const { path } = unref(route);
|
|
||||||
if (path !== ROUTE_PATH) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
query();
|
|
||||||
},
|
|
||||||
{ immediate: true }
|
|
||||||
);
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
export default {
|
|
||||||
name: 'SystemUserDetails'
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
@@ -1,15 +1,16 @@
|
|||||||
<template>
|
<template>
|
||||||
<a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
|
<a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
|
||||||
<a-card title="角色管理" style="margin-bottom: 20px">
|
<!-- <a-card title="超级管理员" style="margin-bottom: 20px">-->
|
||||||
<template #extra>
|
<!-- <Admin />-->
|
||||||
<a-button type="primary" @click="push(`/system/role`)">添加角色</a-button>
|
<!-- </a-card>-->
|
||||||
</template>
|
<!-- <a-card title="项目成员" style="margin-bottom: 20px">-->
|
||||||
<a-space>
|
<!-- <template #extra>-->
|
||||||
<template v-for="(item,_) in roles" :key="index">
|
<!-- <a-button class="ele-btn-icon" @click="openEdit()">-->
|
||||||
<a-button>{{ item.roleName }}</a-button>
|
<!-- <span>添加</span>-->
|
||||||
</template>
|
<!-- </a-button>-->
|
||||||
</a-space>
|
<!-- </template>-->
|
||||||
</a-card>
|
<!-- <Admin />-->
|
||||||
|
<!-- </a-card>-->
|
||||||
<a-card :bordered="false">
|
<a-card :bordered="false">
|
||||||
<!-- 表格 -->
|
<!-- 表格 -->
|
||||||
<ele-pro-table
|
<ele-pro-table
|
||||||
@@ -152,7 +153,6 @@ import {Organization} from '@/api/system/organization/model';
|
|||||||
import {hasRole} from '@/utils/permission';
|
import {hasRole} from '@/utils/permission';
|
||||||
import {getPageTitle, push} from "@/utils/common";
|
import {getPageTitle, push} from "@/utils/common";
|
||||||
import router from "@/router";
|
import router from "@/router";
|
||||||
import {listUserRole} from "@/api/system/userRole";
|
|
||||||
|
|
||||||
// 加载状态
|
// 加载状态
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
|
|||||||
@@ -4,14 +4,12 @@
|
|||||||
style="flex-wrap: wrap"
|
style="flex-wrap: wrap"
|
||||||
v-if="hasRole('superAdmin') || hasRole('admin') || hasRole('foundation')"
|
v-if="hasRole('superAdmin') || hasRole('admin') || hasRole('foundation')"
|
||||||
>
|
>
|
||||||
<a-button type="text" @click="push('/website/navigation')">商品分类</a-button>
|
|
||||||
</a-space>
|
</a-space>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { watch, nextTick } from 'vue';
|
import { watch, nextTick } from 'vue';
|
||||||
import { CmsWebsite } from '@/api/cms/cmsWebsite/model';
|
import { CmsWebsite } from '@/api/cms/cmsWebsite/model';
|
||||||
import { push } from '@/utils/common';
|
|
||||||
import { hasRole } from '@/utils/permission';
|
import { hasRole } from '@/utils/permission';
|
||||||
|
|
||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
|
|||||||
@@ -178,8 +178,7 @@ const columns = ref<ColumnItem[]>([
|
|||||||
{
|
{
|
||||||
title: '订单编号',
|
title: '订单编号',
|
||||||
dataIndex: 'orderNo',
|
dataIndex: 'orderNo',
|
||||||
key: 'orderNo',
|
key: 'orderNo'
|
||||||
align: 'center'
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '商品信息',
|
title: '商品信息',
|
||||||
|
|||||||
@@ -4,33 +4,39 @@
|
|||||||
width="400px"
|
width="400px"
|
||||||
:visible="visible"
|
:visible="visible"
|
||||||
:confirm-loading="loading"
|
:confirm-loading="loading"
|
||||||
:title="'手机验证'"
|
:title="'创建 API key'"
|
||||||
:body-style="{ paddingBottom: '8px' }"
|
:body-style="{ paddingBottom: '8px' }"
|
||||||
@update:visible="updateVisible"
|
@update:visible="updateVisible"
|
||||||
:maskClosable="false"
|
:maskClosable="false"
|
||||||
|
:cancelText="cancelText"
|
||||||
|
:okText="okText"
|
||||||
|
@close="updateVisible"
|
||||||
@ok="save"
|
@ok="save"
|
||||||
>
|
>
|
||||||
<a-form class="login-form">
|
<a-form
|
||||||
<a-form-item label="绑定的手机号码" name="phone">
|
ref="formRef"
|
||||||
{{ getMobile(form.phone) }}
|
:model="form"
|
||||||
</a-form-item>
|
:rules="rules"
|
||||||
<a-form-item label="校验码" name="code">
|
class="login-form">
|
||||||
|
<a-form-item name="accessKey">
|
||||||
<div class="login-input-group">
|
<div class="login-input-group">
|
||||||
<a-input
|
<a-input
|
||||||
|
v-if="form.accessSecret"
|
||||||
allow-clear
|
allow-clear
|
||||||
type="text"
|
type="text"
|
||||||
:maxlength="6"
|
placeholder="请输入API Keys名称"
|
||||||
v-model:value="form.code"
|
v-model:value="form.accessSecret"
|
||||||
>
|
>
|
||||||
</a-input>
|
</a-input>
|
||||||
<a-button
|
<a-input
|
||||||
class="login-captcha"
|
v-else
|
||||||
:disabled="!!countdownTime"
|
allow-clear
|
||||||
@click="openImgCodeModal"
|
type="text"
|
||||||
|
placeholder="请输入API Keys名称"
|
||||||
|
:maxlength="6"
|
||||||
|
v-model:value="form.accessKey"
|
||||||
>
|
>
|
||||||
<span v-if="!countdownTime">发送验证码</span>
|
</a-input>
|
||||||
<span v-else>已发送 {{ countdownTime }} s</span>
|
|
||||||
</a-button>
|
|
||||||
</div>
|
</div>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-form>
|
</a-form>
|
||||||
@@ -38,69 +44,35 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, reactive, watch, computed, onBeforeUnmount } from "vue";
|
import {ref, reactive} from "vue";
|
||||||
import { Form, message, Modal, SelectProps } from "ant-design-vue";
|
import {message} from "ant-design-vue";
|
||||||
import { useUserStore } from "@/store/modules/user";
|
import type {AccessKey} from "@/api/system/access-key/model";
|
||||||
import type { AccessKey } from "@/api/system/access-key/model";
|
import {assignObject} from 'ele-admin-pro';
|
||||||
import { addAccessKey, updateAccessKey } from "@/api/system/access-key";
|
import type { FormInstance, Rule } from 'ant-design-vue/es/form';
|
||||||
import { FILE_SERVER } from "@/config/setting";
|
import {addAccessKey} from "@/api/system/access-key";
|
||||||
import { uploadFile } from "@/api/system/file";
|
import {copyText} from "@/utils/common";
|
||||||
import { RuleObject } from "ant-design-vue/es/form";
|
|
||||||
import { isImage } from "@/utils/common";
|
|
||||||
import { listUsers } from '@/api/system/user';
|
|
||||||
import { getMobile } from '@/utils/common';
|
|
||||||
import { sendSmsCaptcha } from '@/api/passport/login';
|
|
||||||
|
|
||||||
const useForm = Form.useForm;
|
defineProps<{
|
||||||
const props = defineProps<{
|
|
||||||
// 弹窗是否打开
|
// 弹窗是否打开
|
||||||
visible: boolean;
|
visible: boolean;
|
||||||
// 修改回显的数据
|
// 修改回显的数据
|
||||||
data?: AccessKey | null;
|
data?: AccessKey | null;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const userStore = useUserStore();
|
|
||||||
// 当前登录用户信息
|
|
||||||
const loginUser = computed(() => userStore.info ?? {});
|
|
||||||
// 是否是修改
|
|
||||||
const isUpdate = ref(false);
|
|
||||||
const disabled = ref(false);
|
|
||||||
// 选项卡位置
|
|
||||||
const activeKey = ref("1");
|
|
||||||
const promoter = ref<any>(undefined);
|
|
||||||
const commander = ref(undefined);
|
|
||||||
const appid = ref(undefined);
|
|
||||||
|
|
||||||
/* 打开选择弹窗 */
|
|
||||||
const content = ref("");
|
|
||||||
// 图形验证码地址
|
|
||||||
const captcha = ref("");
|
|
||||||
// 验证码倒计时定时器
|
|
||||||
let countdownTimer: number | null = null;
|
|
||||||
// 验证码倒计时时间
|
|
||||||
const countdownTime = ref(0);
|
|
||||||
// 图形验证码
|
|
||||||
const imgCode = ref("");
|
|
||||||
// 发送验证码按钮loading
|
|
||||||
const codeLoading = ref(false);
|
|
||||||
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: "done", form: AccessKey): void;
|
(e: "done", form: AccessKey): void;
|
||||||
(e: "update:visible", value: boolean): void;
|
(e: "update:visible", value: boolean): void;
|
||||||
}>();
|
}>();
|
||||||
// 已上传数据, 可赋初始值用于回显
|
|
||||||
const avatar = ref(<any>[]);
|
|
||||||
// 提交状态
|
// 提交状态
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
|
const cancelText = ref<string>("取消");
|
||||||
|
const okText = ref<string>("创建");
|
||||||
// 用户信息
|
// 用户信息
|
||||||
const form = reactive<AccessKey>({
|
const form = reactive<AccessKey>({
|
||||||
id: 0,
|
id: 0,
|
||||||
phone: "",
|
accessKey: undefined,
|
||||||
accessKey: "",
|
accessSecret: undefined,
|
||||||
accessSecret: "",
|
createTime: undefined
|
||||||
code: undefined,
|
|
||||||
createTime: ""
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/* 更新visible */
|
/* 更新visible */
|
||||||
@@ -109,125 +81,50 @@ const updateVisible = (value: boolean) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 表单验证规则
|
// 表单验证规则
|
||||||
const rules = reactive({
|
const rules = reactive<Record<string, Rule[]>>({
|
||||||
name: [
|
accessKey: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
type: "string",
|
type: "string",
|
||||||
message: "请输入工单名称",
|
message: "请输入API Key 名称",
|
||||||
trigger: "blur"
|
trigger: "blur"
|
||||||
}
|
}
|
||||||
],
|
|
||||||
taskType: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
type: "string",
|
|
||||||
message: "请选择工单类型",
|
|
||||||
trigger: "blur"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
content: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
type: "string",
|
|
||||||
message: "请输入工单内容",
|
|
||||||
trigger: "blur",
|
|
||||||
validator: async (_rule: RuleObject, value: string) => {
|
|
||||||
if (content.value == "") {
|
|
||||||
return Promise.reject("请输入文字内容");
|
|
||||||
}
|
|
||||||
return Promise.resolve();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
/* 显示发送短信验证码弹窗 */
|
const formRef = ref<FormInstance | null>(null);
|
||||||
const openImgCodeModal = () => {
|
|
||||||
if (!form.phone) {
|
|
||||||
message.error("手机号码有误");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// imgCode.value = "";
|
|
||||||
sendCode();
|
|
||||||
// visible.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 发送短信验证码 */
|
|
||||||
const sendCode = () => {
|
|
||||||
codeLoading.value = true;
|
|
||||||
sendSmsCaptcha({ phone: form.phone }).then((res) => {
|
|
||||||
console.log(res);
|
|
||||||
message.success("短信验证码发送成功, 请注意查收!");
|
|
||||||
codeLoading.value = false;
|
|
||||||
countdownTime.value = 30;
|
|
||||||
// 开始对按钮进行倒计时
|
|
||||||
countdownTimer = window.setInterval(() => {
|
|
||||||
if (countdownTime.value <= 1) {
|
|
||||||
countdownTimer && clearInterval(countdownTimer);
|
|
||||||
countdownTimer = null;
|
|
||||||
}
|
|
||||||
countdownTime.value--;
|
|
||||||
}, 1000);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
|
||||||
countdownTimer && clearInterval(countdownTimer);
|
|
||||||
});
|
|
||||||
|
|
||||||
const { validate, validateInfos } = useForm(form, rules);
|
|
||||||
|
|
||||||
/* 保存编辑 */
|
/* 保存编辑 */
|
||||||
const save = () => {
|
const save = () => {
|
||||||
validate()
|
if(form.accessSecret){
|
||||||
|
copyText(form.accessSecret)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!formRef.value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
formRef.value
|
||||||
|
.validate()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
updateVisible(false);
|
loading.value = true;
|
||||||
const { code,phone } = form;
|
addAccessKey(form)
|
||||||
emit("done", { code,phone });
|
.then((data) => {
|
||||||
|
console.log(data,'addData')
|
||||||
|
if(data){
|
||||||
|
assignObject(form, data);
|
||||||
|
cancelText.value = "关闭";
|
||||||
|
okText.value = "复制";
|
||||||
|
}
|
||||||
|
loading.value = false;
|
||||||
|
message.success('创建成功');
|
||||||
|
emit("done", {});
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
loading.value = false;
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const query = () => {
|
|
||||||
listUsers({username: 'admin'}).then(res => {
|
|
||||||
form.phone = res[0].phone;
|
|
||||||
})
|
|
||||||
}
|
|
||||||
query();
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
|
||||||
.login-form{
|
|
||||||
padding: 0 20px;
|
|
||||||
}
|
|
||||||
.login-form-right .login-form {
|
|
||||||
margin: 0 15% 0 auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.login-form-left .login-form {
|
|
||||||
margin: 0 auto 0 15%;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 验证码 */
|
|
||||||
.login-input-group {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
:deep(.ant-input-affix-wrapper) {
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.login-captcha {
|
|
||||||
margin-left: 10px;
|
|
||||||
padding: 0 10px;
|
|
||||||
|
|
||||||
& > img {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<div class="page">
|
<div class="page">
|
||||||
<a-page-header :ghost="false" title="秘钥管理">
|
<a-page-header :ghost="false" title="秘钥管理">
|
||||||
<div class="ele-text-secondary">
|
<div class="ele-text-secondary">
|
||||||
AccessKey ID 和 AccessKey Secret 是您访WebSoft-API
|
API key 是您访WebSoft-API
|
||||||
的密钥,具有该账户完全的权限,请您妥善保管。
|
的密钥,具有该账户完全的权限,请您妥善保管。
|
||||||
</div>
|
</div>
|
||||||
</a-page-header>
|
</a-page-header>
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
<!-- 表格 -->
|
<!-- 表格 -->
|
||||||
<ele-pro-table
|
<ele-pro-table
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
row-key="logId"
|
row-key="id"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:datasource="datasource"
|
:datasource="datasource"
|
||||||
:where="defaultWhere"
|
:where="defaultWhere"
|
||||||
@@ -19,27 +19,26 @@
|
|||||||
>
|
>
|
||||||
<template #toolbar>
|
<template #toolbar>
|
||||||
<a-space>
|
<a-space>
|
||||||
<a-button type="primary" class="ele-btn-icon" @click="add">
|
<a-button type="primary" class="ele-btn-icon" @click="openEdit()">
|
||||||
<template #icon>
|
<span>创建 API key</span>
|
||||||
<plus-outlined />
|
|
||||||
</template>
|
|
||||||
<span>创建 AccessKey</span>
|
|
||||||
</a-button>
|
</a-button>
|
||||||
<a-button @click="reset">刷新</a-button>
|
|
||||||
</a-space>
|
</a-space>
|
||||||
</template>
|
</template>
|
||||||
<template #bodyCell="{ column, record }">
|
<template #bodyCell="{ column, record }">
|
||||||
<template v-if="column.key === 'accessSecret'">
|
<template v-if="column.key === 'accessSecret'">
|
||||||
<span v-if="record.accessSecret">
|
<span>
|
||||||
{{ record.accessSecret }}
|
sk-******************
|
||||||
</span>
|
</span>
|
||||||
<a @click="openEdit(record)" v-else>查看 Secret</a>
|
|
||||||
</template>
|
</template>
|
||||||
<template v-if="column.key === 'action'">
|
<template v-if="column.key === 'action'">
|
||||||
<a-space>
|
<a-space>
|
||||||
<a @click="openEdit(record)">查看 Secret</a>
|
<a-popconfirm
|
||||||
<!-- <a-divider type="vertical" />-->
|
placement="topRight"
|
||||||
<!-- <a @click="resetPsw(record)">禁用</a>-->
|
title="确定要删除此用户吗?"
|
||||||
|
@confirm="remove(record)"
|
||||||
|
>
|
||||||
|
<a class="ele-text-danger">删除</a>
|
||||||
|
</a-popconfirm>
|
||||||
</a-space>
|
</a-space>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
@@ -47,102 +46,110 @@
|
|||||||
</a-card>
|
</a-card>
|
||||||
</div>
|
</div>
|
||||||
<!-- 编辑弹窗 -->
|
<!-- 编辑弹窗 -->
|
||||||
<AccessKeyEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
<AccessKeyEdit v-model:visible="showEdit" :data="current" @done="reload"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, reactive } from 'vue';
|
import {ref, reactive} from 'vue';
|
||||||
import { message } from 'ant-design-vue/es';
|
import {message} from 'ant-design-vue/es';
|
||||||
import type { EleProTable } from 'ele-admin-pro/es';
|
import type {EleProTable} from 'ele-admin-pro/es';
|
||||||
import type {
|
import type {
|
||||||
DatasourceFunction,
|
DatasourceFunction,
|
||||||
ColumnItem
|
ColumnItem
|
||||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||||
import AccessKeyEdit from './components/accesskey-edit.vue';
|
import AccessKeyEdit from './components/accesskey-edit.vue';
|
||||||
import { toDateString } from 'ele-admin-pro/es';
|
import {toDateString} from 'ele-admin-pro/es';
|
||||||
import { addAccessKey, pageAccessKey } from '@/api/system/access-key';
|
import {pageAccessKey, removeAccessKey} from '@/api/system/access-key';
|
||||||
import { AccessKey, AccessKeyParam } from '@/api/system/access-key/model';
|
import {AccessKey, AccessKeyParam} from '@/api/system/access-key/model';
|
||||||
|
import {messageLoading} from 'ele-admin-pro/es';
|
||||||
|
|
||||||
// 表格实例
|
// 表格实例
|
||||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||||
// 表格列配置
|
// 表格列配置
|
||||||
const columns = ref<ColumnItem[]>([
|
const columns = ref<ColumnItem[]>([
|
||||||
{
|
{
|
||||||
title: 'AccessKey ID',
|
title: '名称',
|
||||||
key: 'accessKey',
|
key: 'accessKey',
|
||||||
dataIndex: 'accessKey',
|
dataIndex: 'accessKey',
|
||||||
showSorterTooltip: false
|
showSorterTooltip: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'AccessSecret',
|
title: 'Key',
|
||||||
key: 'accessSecret',
|
key: 'accessSecret',
|
||||||
dataIndex: 'accessSecret',
|
dataIndex: 'accessSecret',
|
||||||
showSorterTooltip: false
|
showSorterTooltip: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '创建时间',
|
title: '创建时间',
|
||||||
dataIndex: 'createTime',
|
dataIndex: 'createTime',
|
||||||
customRender: ({ text }) => toDateString(text)
|
align: 'center',
|
||||||
}
|
customRender: ({text}) => toDateString(text, 'yyyy-MM-dd'),
|
||||||
]);
|
width: 180,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
key: 'action',
|
||||||
|
width: 180,
|
||||||
|
fixed: 'right',
|
||||||
|
align: 'center'
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
// 表格选中数据
|
// 表格选中数据
|
||||||
const selection = ref<AccessKey[]>([]);
|
const selection = ref<AccessKey[]>([]);
|
||||||
const searchText = ref('');
|
// 是否显示编辑弹窗
|
||||||
const userId = ref<number>(0);
|
const showEdit = ref(false);
|
||||||
// 是否显示编辑弹窗
|
// 当前编辑数据
|
||||||
const showEdit = ref(false);
|
const current = ref<any>(null);
|
||||||
// 当前编辑数据
|
|
||||||
const current = ref<any>(null);
|
|
||||||
|
|
||||||
// 默认搜索条件
|
// 默认搜索条件
|
||||||
const defaultWhere = reactive({
|
const defaultWhere = reactive({
|
||||||
code: '',
|
code: '',
|
||||||
phone: '',
|
phone: '',
|
||||||
username: '',
|
username: '',
|
||||||
nickname: '',
|
nickname: '',
|
||||||
userId: undefined
|
userId: undefined
|
||||||
});
|
});
|
||||||
|
|
||||||
// 表格数据源
|
|
||||||
const datasource: DatasourceFunction = ({ page, limit, where, orders }) => {
|
// 表格数据源
|
||||||
return pageAccessKey({ ...where, ...orders, page, limit }).catch((e) => {
|
const datasource: DatasourceFunction = ({where}) => {
|
||||||
|
return pageAccessKey({...where});
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 打开编辑弹窗 */
|
||||||
|
const openEdit = (row?: any) => {
|
||||||
|
current.value = row ?? null;
|
||||||
|
showEdit.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* 删除单个 */
|
||||||
|
const remove = (row: AccessKey) => {
|
||||||
|
const hide = messageLoading('请求中..', 0);
|
||||||
|
removeAccessKey(row.id)
|
||||||
|
.then((msg) => {
|
||||||
|
hide();
|
||||||
|
message.success(msg);
|
||||||
|
reload();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
hide();
|
||||||
message.error(e.message);
|
message.error(e.message);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const reset = () => {
|
/* 搜索 */
|
||||||
userId.value = 0;
|
const reload = (where?: AccessKeyParam) => {
|
||||||
searchText.value = '';
|
selection.value = [];
|
||||||
reload();
|
tableRef?.value?.reload({page: 1, where});
|
||||||
};
|
};
|
||||||
|
|
||||||
/* 打开编辑弹窗 */
|
|
||||||
const openEdit = (row?: any) => {
|
|
||||||
current.value = row ?? null;
|
|
||||||
showEdit.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 搜索 */
|
|
||||||
const reload = (where?: AccessKeyParam) => {
|
|
||||||
selection.value = [];
|
|
||||||
tableRef?.value?.reload({ page: 1, where });
|
|
||||||
};
|
|
||||||
|
|
||||||
const add = () => {
|
|
||||||
addAccessKey({})
|
|
||||||
.then((res) => {
|
|
||||||
reload();
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
message.error(err.message);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export default {
|
export default {
|
||||||
name: 'AccessKeyIndex'
|
name: 'AccessKeyIndex'
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
51
src/views/system/developer/components/info.vue
Normal file
51
src/views/system/developer/components/info.vue
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
<template>
|
||||||
|
<a-table :dataSource="dataSource" :columns="columns" :pagination="false">
|
||||||
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="column.key === 'name'">
|
||||||
|
<div class="flex">
|
||||||
|
<span class="w-32">{{ record.name }}</span>
|
||||||
|
<span class="w-32">{{ record.value }}</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'action'">
|
||||||
|
<template v-if="record.key === '2'">
|
||||||
|
<a-button>重置</a-button>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</a-table>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
setup() {
|
||||||
|
return {
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
title: '开发者ID',
|
||||||
|
dataIndex: 'name',
|
||||||
|
key: 'name',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
dataIndex: 'action',
|
||||||
|
key: 'action',
|
||||||
|
align: 'center',
|
||||||
|
width: 240,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
dataSource: [
|
||||||
|
{
|
||||||
|
key: '1',
|
||||||
|
name: '租户ID',
|
||||||
|
value: '10550'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: '2',
|
||||||
|
name: 'AppSecret',
|
||||||
|
value: 'sdfsdfsdfsdfs'
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
31
src/views/system/developer/index.vue
Normal file
31
src/views/system/developer/index.vue
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<template>
|
||||||
|
<a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
|
||||||
|
<a-card title="开发者ID" style="margin-bottom: 20px">
|
||||||
|
<Info/>
|
||||||
|
</a-card>
|
||||||
|
<a-card title="服务器域名" style="margin-bottom: 20px">
|
||||||
|
<template #extra>
|
||||||
|
<a-button type="primary" @click="push(`/system/role`)">添加</a-button>
|
||||||
|
</template>
|
||||||
|
<Info/>
|
||||||
|
</a-card>
|
||||||
|
<a-card title="业务域名" style="margin-bottom: 20px">
|
||||||
|
<template #extra>
|
||||||
|
<a-button type="primary" @click="push(`/system/role`)">添加</a-button>
|
||||||
|
</template>
|
||||||
|
<Info/>
|
||||||
|
</a-card>
|
||||||
|
</a-page-header>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import {getPageTitle, push} from "@/utils/common";
|
||||||
|
import Info from './components/info.vue'
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default {
|
||||||
|
name: 'SystemDeveloper'
|
||||||
|
};
|
||||||
|
</script>
|
||||||
Reference in New Issue
Block a user