main
wwl 2023-12-22 13:18:03 +08:00
parent 2c92275290
commit 0ec6a2acc7
4 changed files with 230 additions and 101 deletions

View File

@ -1374,3 +1374,7 @@ export async function fetchmoduleStatInternalPage(params?: any) {
export async function fetchPostList(params?: any) {
return http.get(`/common/getPostList`, { params })
}
// 内部足迹
export async function fetchInternalUserStat(params?: any) {
return http.get(`/moduleStat/internalUserStat`, { params })
}

View File

@ -19,7 +19,7 @@
<el-icon class="text-red"><ArrowLeftBold size="18" /></el-icon>
</div>
</div>
<el-tab-pane label="分类管理" name="first">
<el-tab-pane v-if="userCode" label="分类管理" name="first">
<div class="h-52px">
<el-button
v-if="userCode"
@ -401,6 +401,7 @@ async function getTree() {
}
let cateIds = ref()
watchEffect(() => {
activeName.value = userCode ? 'first' : 'second'
cateIds.value = database.database.id
// console.log(database.database.id)
if (database.database.id) {

View File

@ -188,7 +188,7 @@ const openUrl = async (url)=>{
const screenWidth = window.screen.width;
const screenHeight = window.screen.height;
window.open(url, '', 'width=' + screenWidth + ',height=' + screenHeight + ',top=' + 0 + ',left=' + 0)
}
}
else{
message.error("文件格式不是 'doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx','pdf'")
}

View File

@ -6,11 +6,12 @@ import {
externalTimeStat,
fetchmoduleStatExternalPage,
fetchPostList,
fetchmoduleStatInternalPage
fetchmoduleStatInternalPage,
fetchInternalUserStat,
deptTree as fetchDeptTree
} from '@/api/daikin/base'
import { formatDate } from '@/utils/format'
import { Chart1 } from './indexData'
import zhCn from 'element-plus/lib/locale/lang/zh-cn'
import { Search } from '@element-plus/icons-vue'
import { NModal } from 'naive-ui'
const currentDate = new Date()
@ -65,6 +66,68 @@ const outDetail = ref([])
const postId = ref<any>([])
const nickName = ref()
const postList = ref<any>([])
const barOption = {
width: '100%',
height: '100%',
grid: {
top: 0,
left: 10,
right: 10,
bottom: 10,
containLabel: true
},
yAxis: {
data: [],
type: 'category',
axisLabel: {
show: false, // x
interval: 0
}
},
xAxis: {
type: 'value'
},
label: {
show: true,
position: 'right',
// align: 'center',
color: '#333', //
fontSize: 12, //
formatter: function (value: any) {
// console.log(value);
return value.name + ' ' + value.value
},
rotate: 0
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
},
formatter: function ([params]: any) {
const title = `<p>${params.name}</p>`
const colorDot =
'<span style="display:inline-block;margin-right:5px;border-radius:50%;width:10px;height:10px;background-color:' +
params.color +
'"></span>'
return title + colorDot + params.value
}
},
series: [
{
data: [],
type: 'bar',
sort: 'ascending',
itemStyle: {
color: function (params: any) {
// console.log("🚀 ~ file: index.vue:365 ~ params.dataIndex:", params.dataIndex,params.data)
return colorList[9 - params.dataIndex]
}
}
}
]
}
const itemDataList = ref<any>([])
const getPostList = async () => {
const res: any = await fetchPostList()
postList.value = res.data || []
@ -122,16 +185,23 @@ const state = reactive<any>({
endTime: formatDate(value1.value[1]).substring(0, 10)
// timeType:1
})
const dataList = ref()
const colorListObj = ref<any>({})
const dataList = ref([])
const getDat = async () => {
const { data } = await timeStat(state)
dataList.value = data
let xAxisData: any[] = []
let siomesData: any[] = []
data.forEach((item: { moduleName: any; visitCount: any }) => {
xAxisData.push(item.moduleName)
siomesData.push(item.visitCount)
})
data.forEach(
(
item: { moduleName: any; visitCount: any; moduleCode: any },
i: number
) => {
xAxisData.push(item.moduleName)
siomesData.push(item.visitCount)
colorListObj.value[item.moduleCode] = colorList[i]
}
)
chartOption1.value = Chart1(xAxisData)
chartOption1.value.series[0] = {
data: siomesData,
@ -142,6 +212,74 @@ const getDat = async () => {
},
type: 'bar'
}
getInternalUserStat(1)
}
const deptId = ref('')
let isLeaderFlag = 0
async function getInternalUserStat(
isLeader: number = 0,
flag: boolean = false
) {
if (!flag) {
pageInfo.currentPage = 1
pageInfo.pageSize = 10
}
const { currentPage, pageSize } = pageInfo
const { rows = [], total }: any = await fetchInternalUserStat({
...state,
pageNum: currentPage,
pageSize: pageSize,
isLeader,
deptId: deptId.value || ''
})
isLeaderFlag = isLeader
// console.log('🚀 ~ file: index.vue:211 ~ rows:', rows)
pageInfo.total = total
// 10-100
const roundMath = (min: number, max: number) => {
return Math.round(Math.random() * (max - min) + min)
}
// barOption.yAxis.data = data.map((item: any) => item.moduleName)
itemDataList.value = rows.map((item: any, index: number) => {
let itemData: any = {
nickName: item.nickName,
userId: item.userId,
...barOption,
yAxis: {
data: item.moduleStatList.map((item: any) => item.moduleName).reverse(),
type: 'category',
axisLabel: {
show: false, // x
interval: 0
}
},
...{
series: [
{
data: item.moduleStatList
.map((item: any) => item.visitCount)
.reverse(),
// data: new Array(item.moduleStatList.length)
// .fill(0)
// .map(() => roundMath(10, 100)),
type: 'bar',
sort: 'descending', //ascending
itemStyle: {
color: function (params: any) {
// console.log('🚀 ~ file: index.vue:255 ~ params:', params)
return colorList[8 - params.dataIndex]
// return colorListObj.value[item.moduleCode] || '#8F97F8'
}
}
}
]
}
}
itemData.index = index + 1
itemData.sortNum = (currentPage - 1) * pageSize + index + 1
return itemData
})
}
const externalList = ref<any>([])
@ -297,75 +435,9 @@ const echartsItemColor = [
'#6f5553',
'#c14089'
]
const barOption = {
width: '100%',
height: '100%',
grid: {
top: 0,
left: 10,
right: 5,
bottom: 10,
containLabel: true
},
yAxis: {
data: [
'Mon',
'Tue',
'Wed',
'Thu',
'Fri',
'Sat',
'Sun',
'hour',
'month',
'year'
],
axisLabel: {
show: false, // x
interval: 0
}
},
xAxis: {
type: 'value'
},
label: {
show: true,
position: 'inside',
align: 'center',
color: '#333', //
fontSize: 14, //
formatter: function (value: any) {
// console.log(value);
return value.name + ' ' + value.value
},
rotate: 0
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
},
formatter: function ([params]: any) {
const title = `<p>${params.name}</p>`
const colorDot =
'<span style="display:inline-block;margin-right:5px;border-radius:50%;width:10px;height:10px;background-color:' +
params.color +
'"></span>'
return title + colorDot + params.value
}
},
series: [
{
data: [120, 200, 150, 80, 70, 110, 130, 123, 50, 80],
type: 'bar',
itemStyle: {
color: function (params: any) {
return colorList[params.dataIndex]
}
}
}
]
}
// console.log(Object.assign(barOption.series[0], { data: [120, 200, 150, 80, 70, 110, 130, 123, 50] }));
const showModal = ref(false)
const setUserList = ref<any>([])
@ -382,7 +454,29 @@ const CloseThiss = (data?: boolean) => {
// setUserList.value = []
}
const isDev = false
const sortArr = [
'1ST',
'2ND',
'3RD',
'4TH',
'5TH',
'6TH',
'7TH',
'8TH',
'9TH',
'10TH'
]
const treeData = ref([])
const getdeptTree = async () => {
const { data = [] }: any = await fetchDeptTree({})
treeData.value = data
}
const handleChildChange = (data: any) => {
console.log('🚀 ~ file: index.vue:470 ~ data:', data)
}
getdeptTree()
</script>
<template>
@ -527,51 +621,73 @@ const isDev = false
</div>
<div class="mt-30px">
<div class="flex items-center" v-if="isDev">
<span class="text-#000 mr-10px">模块: </span>
<el-select v-model="moduleCode" placeholder="选择模块" clearable>
<span class="text-#000 mr-10px">部门: </span>
<!-- <el-select v-model="moduleCode" placeholder="选择部门" clearable>
<el-option
v-for="item in externalList"
:key="item.id"
:label="item.moduleName"
:value="item.moduleCode"
/>
</el-select>
</el-select> -->
<el-cascader
class="!w-380px"
v-model="deptId"
:options="treeData"
:props="{
expandTrigger: 'hover',
checkStrictly: true,
emitPath: false,
value: 'id'
}"
@change="handleChildChange"
clearable
></el-cascader>
<el-button
type="primary"
:icon="Search"
size="small"
class="ml20px"
@click="handleClick({ paneName: activeName })"
@click="getInternalUserStat(0)"
>搜索</el-button
>
<el-button
type="primary"
type="warning"
:icon="Search"
size="small"
class="ml20px"
@click="showModal = true"
class="!ml30px"
@click="getInternalUserStat(1)"
>部长以上人员足迹</el-button
>
</div>
<div class="pb-14px" v-if="isDev">
<div class="pb-14px">
<div class="flex flex-wrap mb-30px">
<div
class="m-4 flex items-center justify-between w-45% h-full"
v-for="i in 10"
v-for="(item, i) in itemDataList"
:key="i"
>
<div class="flex items-center text-#000 text-22px">
<p class="text-bold text-40px">{{ i }}TH</p>
<div class="flex items-center text-#000 text-18px">
<p class="text-bold text-40px mr-15px w-80px">
{{ sortArr[item.sortNum - 1] || item.sortNum + 'TH' }}
</p>
<div class="mx-10px flex-col items-center">
<img src="@/views/extermal/images/zanwly2.png" alt="" />
<p class="text-center mt-10">测试 {{ i }}</p>
<img
v-if="i % 2 == 0"
class="rounded-md h-150px object-contain"
src="@/views/home/images/nan.png"
alt=""
/>
<img
v-else
class="rounded-md h-150px object-contain"
src="@/views/home/images/nv.png"
alt=""
/>
<p class="text-center mt-20px">{{ item.nickName }}</p>
</div>
</div>
<VChart
class="h-300px w-65% pb-10px ml-auto"
key="yyy1"
:option="barOption"
/>
<VChart class="h-300px w-65% ml-auto" :option="item" />
</div>
</div>
<div class="absolute bottom-2px right-30px z-20 bg-#fff">
@ -580,8 +696,8 @@ const isDev = false
v-model:page-size="pageInfo.pageSize"
layout="prev, pager, next, jumper"
:total="pageInfo.total"
@size-change="getInsideListPage"
@current-change="getInsideListPage"
@size-change="getInternalUserStat(isLeaderFlag, true)"
@current-change="getInternalUserStat(isLeaderFlag, true)"
/>
</div>
</div>
@ -606,7 +722,11 @@ const isDev = false
textAlign: 'center',
'font-size': '24px'
}"
:cell-style="{ 'text-align': 'center', 'overflow-y': 'auto' }"
:cell-style="{
'text-align': 'center',
'overflow-y': 'auto',
height: '60px'
}"
>
<el-table-column prop="moduleName" label="模块名称" />
<el-table-column
@ -662,7 +782,11 @@ const isDev = false
textAlign: 'center',
'font-size': '24px'
}"
:cell-style="{ 'text-align': 'center', 'overflow-y': 'auto' }"
:cell-style="{
'text-align': 'center',
'overflow-y': 'auto',
height: '60px'
}"
>
<el-table-column
prop="title"