fix: 个人中心自测、优化

This commit is contained in:
easy 2023-03-09 19:52:00 +08:00
parent d650757dc2
commit d2e7a410b7
6 changed files with 59 additions and 40 deletions

View File

@ -1,7 +1,7 @@
import server from '@/utils/request'
// 获取记录列表
export const getList_api = (data:object): any =>server.get(`/notifications/_query`,encodeParams(data))
export const getList_api = (data:object): any =>server.post(`/notifications/_query`,data)
// 修改记录状态
export const changeStatus_api = (type:'_read'|'_unread',data:string[]): any =>server.post(`/notifications/${type}`,data)

View File

@ -26,7 +26,7 @@ import { notification } from 'ant-design-vue';
import { changeStatus_api } from '@/api/account/notificationRecord';
import { useUserInfo } from '@/store/userInfo';
const updateCount = computed(()=>useUserInfo().$state.alarmUpdateCount);
const updateCount = computed(() => useUserInfo().$state.alarmUpdateCount);
const total = ref(0);
const list = ref<any[]>([]);
@ -50,10 +50,20 @@ const subscribeNotice = () => {
const getList = () => {
loading.value = true;
const params = {
'terms[0].column': 'state',
'terms[0].value': 'unread',
'sorts[0].name': 'notifyTime',
'sorts[0].order': 'desc',
terms: [
{
terms: [
{
type: 'or',
value: 'unread',
termType: 'eq',
column: 'state',
},
],
},
],
};
getList_api(params)
.then((resp: any) => {

View File

@ -1,14 +1,17 @@
<template>
<page-container>
<div class="notification-record-container">
<Search :columns="columns" @search="query.search" />
<j-advanced-search
:columns="columns"
@search="(params:any)=>queryParams = {...params}"
/>
<j-pro-table
ref="tableRef"
:columns="columns"
:request="getList_api"
model="TABLE"
:params="query.params.value"
:params="queryParams"
:defaultParams="{
'sorts[0].name': 'notifyTime',
'sorts[0].order': 'desc',
@ -52,8 +55,8 @@
? '标为未读'
: '标为已读',
}"
>1
<AIcon type="ReadIconOutlined" />
>
<AIcon type="icon-a-PIZHU1" />
</PermissionButton>
<PermissionButton
type="link"
@ -158,15 +161,10 @@ const columns = [
key: 'action',
ellipsis: true,
scopedSlots: true,
width:'200px'
width: '200px',
},
];
const query = {
params: ref({}),
search: (params: object) => {
query.params.value = { ...params };
},
};
const queryParams = ref({});
const tableRef = ref();
const table = {

View File

@ -1,13 +1,16 @@
<template>
<page-container>
<div class="notification-subscription-container">
<Search :columns="columns" @search="query.search" />
<j-advanced-search
:columns="columns"
@search="(params:any)=>queryParams = {...params}"
/>
<j-pro-table
ref="tableRef"
:columns="columns"
:request="getNoticeList_api"
model="TABLE"
:params="query.params.value"
:params="queryParams"
:defaultParams="{
sorts: [{ name: 'notifyTime', order: 'desc' }],
}"
@ -105,7 +108,7 @@ import EditDialog from './components/EditDialog.vue';
import {
getNoticeList_api,
changeStatus_api,
remove_api
remove_api,
} from '@/api/account/notificationSubscription';
import { rowType } from './typing';
import { message } from 'ant-design-vue';
@ -147,19 +150,14 @@ const columns = [
key: 'action',
ellipsis: true,
scopedSlots: true,
width: '200px'
width: '200px',
},
];
const query = {
params: ref({}),
search: (params: object) => {
query.params.value = {...params};
},
};
const queryParams = ref({});
const dialogVisible = ref<boolean>(false);
const tableRef = ref();
const table = {
seletctRow: ref<rowType>(),
seletctRow: ref<any>({}),
edit: (row?: rowType) => {
table.seletctRow = {
...(row || ({} as any)),
@ -176,12 +174,12 @@ const table = {
});
},
delete: (row: rowType) => {
remove_api(row.id as string).then(resp=>{
if(resp.status === 200) {
message.success('操作成功!')
table.refresh()
}else message.warning('操作失败!')
})
remove_api(row.id as string).then((resp) => {
if (resp.status === 200) {
message.success('操作成功!');
table.refresh();
} else message.warning('操作失败!');
});
},
refresh: () => {
tableRef.value && tableRef.value.reload();

View File

@ -36,7 +36,7 @@
<ProductChooseDialog
v-if="productDialogVisible"
v-model:visible="productDialogVisible"
@confirm="(id:string)=>jumpPage('device/Product/Detail', { id })"
@confirm="(id:string)=>jumpPage('device/Product/Detail', { id, tab: 'Device'})"
/>
<DeviceChooseDialog
v-if="deviceDialogVisible"
@ -80,7 +80,7 @@ const deviceBootConfig: bootConfig[] = [
auth: productPermission('add'),
image: '/images/home/guide-home1.png',
params: {
type: 'add',
save: true,
},
},
{
@ -100,7 +100,7 @@ const deviceBootConfig: bootConfig[] = [
auth: rulePermission('add'),
image: '/images/home/guide-home3.png',
params: {
type: 'add',
save: true,
},
},
];
@ -115,7 +115,7 @@ const deviceStepDetails: recommendList[] = [
linkUrl: 'device/Product',
auth: productPermission('add'),
params: {
type: 'add',
save: true,
},
},
{
@ -227,4 +227,17 @@ const opsStepDetails: recommendList[] = [
const productDialogVisible = ref(false);
const deviceDialogVisible = ref(false);
// ---- {save:true}
// ----- {id: 'xxxx', tab:'xxx'}
// ---- {save: true}
// ----
// ----
// -----
// ----
</script>

View File

@ -23,7 +23,7 @@
<ProductChooseDialog
v-if="productDialogVisible"
v-model:visible="productDialogVisible"
@confirm="(id:string)=>jumpPage('device/Product/Detail', { id })"
@confirm="(id:string)=>jumpPage('device/Product/Detail', { id, tab: 'Device'})"
/>
<DeviceChooseDialog
v-if="deviceDialogVisible"
@ -67,7 +67,7 @@ const deviceBootConfig: bootConfig[] = [
link: 'device/Product',
auth: productPermission('add'),
params: {
type: 'add',
save: true,
},
},
{
@ -85,7 +85,7 @@ const deviceBootConfig: bootConfig[] = [
link: 'rule-engine/Instance',
auth: rulePermission('add'),
params: {
type: 'add',
save: true,
},
},
];
@ -98,7 +98,7 @@ const deviceStepDetails: recommendList[] = [
linkUrl: 'device/Product',
auth: productPermission('add'),
params: {
type: 'add',
save: true,
},
},
{