新增角色,修改角色测试

This commit is contained in:
GUjiYN 2024-02-14 22:35:49 +08:00
parent 855c43aed9
commit e39695f0c5
2 changed files with 25 additions and 29 deletions

View File

@ -44,32 +44,26 @@
> >
<div style=""> <div style="">
<div style="margin-bottom: 10px;"> <div style="margin-bottom: 10px;">
<div style="margin-left: 15px; margin-bottom: 15px">角色id <a-input v-model:value="roleid" style="width: 250px" type="number" /></div> <div style="margin-left: 15px; margin-bottom: 15px">角色id <a-input v-model:value="updateData.id" style="width: 250px" type="number" /></div>
<div style="margin-left: 15px; margin-bottom: 15px">角色名称<a-input v-model="updateData.name" style="width: 250px" /></div> <div style="margin-left: 15px; margin-bottom: 15px">角色名称<a-input v-model:value="updateData.name" style="width: 250px" /></div>
<div style="margin-left: 15px; margin-bottom: 15px">角色备注<a-input v-model="updateData.displayName" style="width: 250px;" /></div> <div style="margin-left: 15px; margin-bottom: 15px">角色备注<a-input v-model:value="updateData.displayName" style="width: 250px;" /></div>
</div> </div>
</div> </div>
</a-modal> </a-modal>
<div class="table"> <div class="table">
<a-table :columns="columns" :data-source="states.data" :pagination="pagination" :row-selection="rowSelection" <a-table :columns="columns" :data-source="states.data" :row-selection="rowSelection"
:loading="loading" :loading="loading"
@change="handleTableChange"> @change="handleTableChange">
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<template v-if="column.key === 'role_name'"> <template v-if="column.key === 'roleName'">
{{ record.role_name }} {{ record.roleName }}
</template> </template>
<template v-else-if="column.key === 'role_id'"> <template v-else-if="column.key === 'displayName'">
{{record.role_id}} {{record.displayName}}
</template> </template>
<template v-else-if="column.key === 'role_state'"> <template v-else-if="column.key === 'id'">
<a-tag {{record.id}}
v-for="tag in record.role_state"
:key="tag"
:color="tag === 'loser' ? 'volcano' : tag.length > 5 ? 'geekblue' : 'green'"
>
{{ tag.toUpperCase() }}
</a-tag>
</template> </template>
<template v-else-if="column.key === 'createdAt'"> <template v-else-if="column.key === 'createdAt'">
{{record.createdAt}} {{record.createdAt}}
@ -103,10 +97,10 @@ const roleid = ref('');
const AddDiaLog = ref(false); const AddDiaLog = ref(false);
const DeleteDiaLog = ref(false); const DeleteDiaLog = ref(false);
const editDiaLog = ref(false); const editDiaLog = ref(false);
const token = 'eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxNiIsImV4cCI6MTcwNzA0OTQxM30.E5c9_3_PTAKUpCTXmgX7PCN5giV9zp66b1JUesxXURM' const token = 'eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxNiIsImV4cCI6MTcwNzk3NDM1MH0.pi7yFk4RMrUuAhfIz7DEtSahOWwNi55A4vCXimf4Eyo'
const states = reactive({ const states = reactive({
data:[] data:[]
}) });
const updateData = reactive({ const updateData = reactive({
id: 0, id: 0,
name: '', name: '',
@ -159,6 +153,8 @@ const addData = reactive({
function showAddDiaLog(){ function showAddDiaLog(){
AddDiaLog.value = true; AddDiaLog.value = true;
addData.name = '';
addData.displayName = '';
} }
function addOk () { function addOk () {
@ -271,18 +267,18 @@ function searchRole(){
const columns = [ const columns = [
{ {
title: '角色名称', title: '角色名称',
dataIndex: 'role_name', dataIndex: 'roleName',
key: 'role_name', key: 'roleName',
},
{
title: '角色备注',
dataIndex: 'displayName',
key:'displayName',
}, },
{ {
title: '排序', title: '排序',
dataIndex: 'role_id', dataIndex: 'id',
key: 'role_id', key: 'id',
},
{
title: '角色状态',
dataIndex: 'role_state',
key: 'role_state',
}, },
{ {
title: '创建时间', title: '创建时间',

View File

@ -208,7 +208,7 @@ const EditDiaLog = ref(false);
let dataSource = ref([]); let dataSource = ref([]);
let data = ref([]); let data = ref([]);
const dataLoaded = ref(false); const dataLoaded = ref(false);
const token = "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxNiIsImV4cCI6MTcwNzA0OTQxM30.E5c9_3_PTAKUpCTXmgX7PCN5giV9zp66b1JUesxXURM" const token = "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxNiIsImV4cCI6MTcwNzk3NDM1MH0.pi7yFk4RMrUuAhfIz7DEtSahOWwNi55A4vCXimf4Eyo"
const requestBody = { const requestBody = {
"page": null, "page": null,
"limit": null, "limit": null,
@ -523,7 +523,7 @@ async function fetchData() {
search: null, search: null,
role: null role: null
}, },
"eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxNiIsImV4cCI6MTcwNzA0OTQxM30.E5c9_3_PTAKUpCTXmgX7PCN5giV9zp66b1JUesxXURM" "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxNiIsImV4cCI6MTcwNzk3NDM1MH0.pi7yFk4RMrUuAhfIz7DEtSahOWwNi55A4vCXimf4Eyo"
); );
console.log(queryData.data); // 访 console.log(queryData.data); // 访
dataSource.value = queryData.data.data; dataSource.value = queryData.data.data;