fix: bug#16277、16265

This commit is contained in:
leiqiaochu 2023-07-12 17:00:19 +08:00
parent f35fd74006
commit 42970df453
3 changed files with 64 additions and 45 deletions

View File

@ -47,7 +47,7 @@
total: dataSource.length,
current: current,
pageSize: pageSize,
pageSizeOptions: ['10', '20', '50', '100'],
pageSizeOptions: ['12', '24', '48', '96'],
showSizeChanger: true,
hideOnSinglePage: false,
showTotal: (total: number, range: number) => `${range[0]} - ${range[1]} 条/总共 ${total}`,
@ -209,7 +209,7 @@ watch(
const onTreeSelect = (keys: any) => {
if (keys.length) {
deptId.value = keys[0];
pageSize.value = 10;
pageSize.value = 12;
current.value = 1;
}
};
@ -401,7 +401,7 @@ const getTableData = (terms?: any) => {
* 前端分页
*/
const current = ref(1);
const pageSize = ref(10);
const pageSize = ref(12);
const handleTableChange = (pagination: any) => {
current.value = pagination.current;
pageSize.value = pagination.pageSize;

View File

@ -0,0 +1,56 @@
<template>
<JsonViewer :value=context :expanded="true" :expandDepth="4"></JsonViewer>
</template>
<script lang="ts" setup>
import JsonViewer from 'vue-json-viewer';
import templateApi from '@/api/notice/template';
const props = defineProps({
data: Object
})
const typeObj = {
weixin: 'wechat',
dingTalk: 'dingtalk',
};
/**
* 查看用户名
*/
const userList = ref([])
const departmentList = ref([])
const detailData = ref();
const context = ref()
/**
* 改变部门和用户
*/
const replaceData = async (data: any) => {
detailData.value = data
context.value = data.context
if (context.value.hasOwnProperty('userIdList') || context.value.hasOwnProperty('toUser')) {
templateApi.getUser(
typeObj[detailData.value.notifyType],
detailData.value.notifierId,
).then((res: any) => {
if (res.status === 200) {
userList.value = res.result
userList.value.forEach((item: any) => {
item.id === context.value?.userIdList ? context.value.userIdList = item.name : ''
item.id === context.value?.toUser ? context.value.toUser = item.name : ''
})
}
})
}
if (context.value.hasOwnProperty('departmentIdList')) {
templateApi.getDept(typeObj[detailData.value.notifyType],
detailData.value.notifierId).then((res: any) => {
if (res.status === 200) {
departmentList.value = res.result
departmentList.value.forEach((item: any) => {
item.id === context.value.departmentIdList ? context.value.departmentIdList = item.name : ''
})
}
})
}
}
replaceData(props.data)
</script>
<style lang="less" scoped></style>

View File

@ -35,7 +35,7 @@
<AIcon
type="ExclamationCircleOutlined"
style="color: #1d39c4; cursor: pointer"
@click="handleDetail(slotProps.context,slotProps)"
@click="handleDetail(slotProps)"
/>
</template>
</JProTable>
@ -47,7 +47,7 @@ import templateApi from '@/api/notice/template';
import { PropType } from 'vue';
import moment from 'moment';
import { Modal } from 'jetlinks-ui-components';
import JsonViewer from 'vue-json-viewer';
import Record from './components/Record.vue'
type Emits = {
(e: 'update:visible', data: boolean): void;
};
@ -127,31 +127,6 @@ const handleSearch = (e: any) => {
params.value = e;
};
const typeObj = {
weixin: 'wechat',
dingTalk: 'dingtalk',
};
/**
* 查看用户名
*/
const userList = ref([])
const departmentList = ref([])
const queryUser = (id:any,notifyType:any,goal:any) =>{
goal ==='user' ? templateApi.getUser(
typeObj[notifyType],
id,
).then((res:any)=>{
if(res.status === 200){
userList.value = res.result
}
}) : templateApi.getDept(typeObj[notifyType],
id,).then((res:any)=>{
if(res.status === 200){
departmentList.value = res.result
}
})
}
/**
* 查看错误信息
*/
@ -173,25 +148,13 @@ const handleError = (e: any) => {
/**
* 查看详情
*/
const handleDetail =async (e: any,data:any) => {
if(e.hasOwnProperty('userIdList')){
await queryUser(data.notifierId,data.notifyType,'user')
userList.value.forEach((item:any)=>{
item.id === e.userIdList ? e.userIdList = item.name : ''
})
}
if(e.hasOwnProperty('departmentIdList')){
}
const handleDetail = (data:any) => {
Modal.info({
title: '详情信息',
content: h(
JsonViewer,
Record,
{
value:JSON.stringify(e,null,1),
expanded:"true",
expandDepth:"4",
data:data,
style: {
maxHeight: '300px',
overflowY: 'auto',