main
王文龙 2023-12-08 09:28:36 +08:00
parent fa7ed63104
commit c7f492865f
5 changed files with 112 additions and 52 deletions

2
components.d.ts vendored
View File

@ -16,7 +16,6 @@ declare module 'vue' {
AppNewsBox: typeof import('./src/components/AppNewsBox.vue')['default']
AppPagination: typeof import('./src/components/AppPagination.vue')['default']
ElButton: typeof import('element-plus/es')['ElButton']
ElCascader: typeof import('element-plus/es')['ElCascader']
ElCol: typeof import('element-plus/es')['ElCol']
ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider']
ElDatePicker: typeof import('element-plus/es')['ElDatePicker']
@ -32,6 +31,7 @@ declare module 'vue' {
ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
ElOption: typeof import('element-plus/es')['ElOption']
ElPagination: typeof import('element-plus/es')['ElPagination']
ElPopconfirm: typeof import('element-plus/es')['ElPopconfirm']
ElProgress: typeof import('element-plus/es')['ElProgress']
ElRadio: typeof import('element-plus/es')['ElRadio']
ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']

View File

@ -3,7 +3,7 @@ import { RouterView } from 'vue-router'
import { useUserStore } from '@/stores/modules/user'
import { treeDbList,download } from '@/api/daikin/base'
import {databaseld} from "@/stores/modules/database"
import { NPopover } from 'naive-ui'
import { NPopover } from 'naive-ui'
const { push } = useRouter()
const store = useUserStore()
@ -11,10 +11,10 @@ const database = databaseld()
const { toggle } = inject<any>('fullscreen')
const activeMenuKey = ref()
let idx = ref(0)
const onClic = ref(false)
const titles = ref()
function menuHandler(menu: any, index: number) {
console.log(menu)
console.log(menu,index)
activeMenuKey.value = menu.id
titles.value = menu.name
idx.value = index;
@ -29,10 +29,10 @@ function goChild(menu: any) {
console.log(menu.id)
database.database.id =menu.id
}
var activeItem = ref()
var activeItem = ref<any>()
const tableData = ref()
async function getTree() {
const { data } = await treeDbList({})
const { data = [] } = await treeDbList({})
tableData.value = data
if(data&&data[0]){
@ -45,13 +45,37 @@ async function getTree() {
// activeMenuKey.value = data[0].childList[0].id
// }
}
if(activeItem.value){
const { topLevelItem, targetItem } = findItemById(data,activeItem.value)
if(topLevelItem && targetItem){
const index = data.findIndex((i:any) => i.id === topLevelItem.id)
nextTick(()=>{
onClic.value = true
menuHandler(topLevelItem,index === -1 ? 0 : index)
goChild(targetItem)
})
}
}
}
onMounted(() => {
getTree()
})
getTree()
const onClic = ref(false)
function findItemById(items:any, targetId:any, topLevelItem:any = null):any {
for (let i = 0; i < items.length; i++) {
const item = items[i];
if (item.id === targetId) {
return { topLevelItem: topLevelItem || item, targetItem: item };
} else if (item.childList?.length > 0) {
const result = findItemById(item.childList, targetId, topLevelItem || item);
if (result) {
return result;
}
}
}
return {topLevelItem: null, targetItem: null};
}
</script>
<template>

View File

@ -175,8 +175,8 @@
<el-tooltip :content="handTooltip(scope.row.userList)" placement="top">
<div class="!h-50px descStyle">
<div class="descStyle max-w-60vw !h-46px ">
<p v-for="(it, e) in scope.row.userList" :class="scope.row.userList.length < 2 ? '!leading-46px' : ''">
{{ it.nickName }}
<p v-for="(it, e) in scope.row.userList" :class="scope.row.userList.length < 2 ? '!leading-46px' : 'xx'">
{{ it.nickName || undefined }}
<span v-if="e == 1 && scope.row.userList.length > 2"
>...{{ scope.row.userList.length }}</span
>
@ -322,7 +322,7 @@
</el-form>
</div>
</NModal>
<n-modal v-model:show="showModal">
<n-modal v-model:show="showModal" :z-index="99999">
<UserList
:userDataList="setUserList"
@clickChild="handleChild"
@ -381,7 +381,7 @@ async function getTree() {
let cateIds = ref()
watchEffect(() => {
cateIds.value = database.database.id
console.log(database.database.id)
// console.log(database.database.id)
if (database.database.id) {
getInfo(database.database.id)
getAuth()
@ -734,7 +734,7 @@ const handleClick = () => {
push({path:'/DataBase/review',query:{cateId:cateIds.value}})
}
const handTooltip = (data: any[] = []) => {
return data.map((item:any) => item.nickName)?.join(', ') || ''
return data.map((item:any) => item.nickName)?.join(', ') || undefined
}
</script>
<style lang="less" scoped>

View File

@ -4,6 +4,7 @@ import { timeStat,externalTimeStat } 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'
const currentDate = new Date()
const currentDates = new Date()
const value1 = ref<[Date, Date]>([
@ -62,7 +63,7 @@ const getDat = async () => {
chartOption1.value = Chart1(xAxisData,siomesData)
}
const externalList = ref()
const externalList = ref<any>([])
const getExternalTimeStat = async () => {
const { data } = await externalTimeStat(state)
externalList.value = data
@ -169,12 +170,14 @@ const handleClick = ({paneName}:any) => {
paneName === 'out' && getExternalTimeStat()
paneName === 'inside' && getDat()
}
const selValue =ref('')
</script>
<template>
<HomeHead class="top"></HomeHead>
<div class="w-full h-834px mt30px rd-20px bg-#fff p30px overflow-hidden">
<div>
<div class="min-h-30px ">
<span class="text-#000">日期: </span>
<el-config-provider :locale="zhCn">
<el-date-picker
@ -195,6 +198,16 @@ const handleClick = ({paneName}:any) => {
class="ml20px mt--5px"
>搜素</el-button
>
<template v-if="activeName !== 'inside' && false">
<el-select v-model="selValue" class="ml-20px mt-[-4px]" placeholder="Select" size="small">
<el-option
v-for="item in externalList"
:key="item.moduleCode"
:label="item.moduleName"
:value="item.moduleCode"
/>
</el-select>
</template>
<!-- <el-button :type="primary == 1 ? 'primary' : ''" :icon="Search" class="!ml100px mt--5px"
@click="clickButton(1)">本日</el-button>
<el-button :type="primary == 2 ? 'primary' : ''" :icon="Search" class="!ml30px mt--5px"

View File

@ -1,42 +1,65 @@
import * as echarts from "echarts";
import {topStat} from '@/api/daikin/base'
import {getPreviousMonths} from '@/utils/format'
function formatDate(inputDate: string) {
const dateRegex = /^(\d{4})-(\d{2})$/
const match = inputDate.match(dateRegex)
if (match) {
const year = match[1]
let month = match[2]
if (month.startsWith('0')) {
month = month.substring(1)
}
return `${year}${month}`
} else {
return inputDate
}
}
export function useChart21() {
const chartRef = ref()
const optionRef = ref()
getData()
async function getData() {
const { data } = await topStat();
const chartRef = ref()
const optionRef = ref()
getData()
async function getData() {
const { data } = await topStat()
const option = {
legend: {},
title:{text:'件',textStyle:{'fontSize':14,'fontWeight':500},subtext:'数',top:'45%'},
tooltip: {
trigger: 'axis',
axisPointer: {
animation: false
}
},
grid: {
left: '6%',
right: '4%',
bottom: '5%',
containLabel: true
},
yAxis: {
type: 'value',
show:true,
},
xAxis: {
type: 'category',
data: getPreviousMonths()
},
series:data
}
optionRef.value =option
}
return { chartRef, option:optionRef }
const option = {
legend: {},
title: {
text: '件',
textStyle: { fontSize: 14, fontWeight: 500 },
subtext: '数',
subtextStyle: { fontSize: 14, fontWeight: 500, color: '#000' },
top: '45%'
},
tooltip: {
trigger: 'axis',
axisPointer: {
animation: false
}
},
grid: {
left: '6%',
right: '4%',
bottom: '5%',
containLabel: true
},
yAxis: {
type: 'value',
show: true
},
xAxis: {
type: 'category',
data: data[0]?.month
? data[0].month.map((item: any) => {
return formatDate(item)
})
: []
},
series: data
}
optionRef.value = option
}
return { chartRef, option: optionRef }
}