main
王文龙 2023-12-11 17:27:45 +08:00
parent 0599685ab7
commit 4ce47123c8
4 changed files with 71 additions and 19 deletions

View File

@ -57,8 +57,13 @@ const getStatListlBar = async ([startYear, endYear] = [2020, 2023]) => {
const year = Number(startYear) + i
arr.push(year)
const item = data.find((it:any) => +it.year === year)
serieOne.push(item ? item.dis : 0)
serieTwo.push(item ? item.dsz : 0)
serieOne.push({value:item ? item.dis : 0,itemStyle:{}})
serieTwo.push({value:item ? item.dsz : 0,itemStyle:{}})
}
serieOne[0].itemStyle = {
shadowColor: 'rgba(0, 0, 0, 0.7)',
shadowOffsetY: 10,
shadowBlur: 20
}
option.value.xAxis.data = arr
option.value.series[0].data = serieOne
@ -66,11 +71,15 @@ const getStatListlBar = async ([startYear, endYear] = [2020, 2023]) => {
}
const statListlPieData = ref([])
const getStatListlPie = async ( year = '2020', channel = 'DIS') => {
const pieUseTotalData = ref(0)
const pieDischargeTotal = ref(0)
const getStatListlPie = async ( year = option.value.xAxis.data || '2020', channel = 'DIS') => {
numberList.forEach((item) => {
pieDecObj.value[item + 1] = 0
pieDecObj.value[item + 2] = 0
})
pieUseTotalData.value = 0
pieDischargeTotal.value = 0
const { data = [] } = await fetchStatListlPie({
year,
channel
@ -87,10 +96,12 @@ const getStatListlPie = async ( year = '2020', channel = 'DIS') => {
name: numberObj[item],
value: pieDecObj.value[item + 1] || '-'
})
pieUseTotalData.value += pieDecObj.value[item + 1] || 0
optionP1.value.series[1].data.push({
name: numberObj[item],
value: pieDecObj.value[item + 2] || '-'
})
pieDischargeTotal.value += pieDecObj.value[item + 2] || 0
})
}
@ -98,7 +109,6 @@ const getStatListlPie = async ( year = '2020', channel = 'DIS') => {
onMounted( () => {
const char = charData()
option.value = char.option.value
console.log("🚀 ~ file: CSRContent22.vue:36 ~ option:", option)
// chartRef.value = char.chartRef.value
const char1 = charData2()
option1.value = char1.option.value
@ -111,6 +121,16 @@ onMounted( () => {
})
const chartClick = (it:any) => {
option.value.series.forEach((item:any) => {
item.data.forEach((i:any) => {
i.itemStyle = {}
})
})
option.value.series[it.seriesIndex].data[it.dataIndex].itemStyle = {
shadowColor: 'rgba(0, 0, 0, 0.7)',
shadowOffsetY: 10,
shadowBlur: 20
};
getStatListlPie(it.name, it.seriesName)
pieYear.value = (+it.name).toString().substring(2)
}
@ -230,11 +250,17 @@ const handleDateChange = (val:any) => {
style="align-content: space-between"
>
<div class="w-full h-70% bg-#fff" style="border-radius: 25px 25px 0 0">
<div class="text-center text-#265DD5 text-22px py20px font-extrabold">
<div class="text-center text-#265DD5 text-22px pt20px pb-10px font-extrabold">
原材料用量及碳排放量占比图<br />
<span class="text-16px mt10px"> (FY{{pieYear}}BASE基准)</span>
<!-- <span class="text-16px mt10px"> (FY{{pieYear}}BASE基准)</span> -->
<!-- <div class="h-10px mt10px"> </div> -->
</div>
<div class="w-full h-400px">
<div class="relative w-full h-430px">
<div class="w-130px h-26px absolute left-0 top-0 bg-white z-10"></div>
<div class="absolute top-7 right-6 text-14px leading-20px opacity-90">
<p class="text-right">原材料使用量合计{{ pieUseTotalData }}千克</p>
<p class="text-right">原材料碳排放量合计{{ pieDischargeTotal }}</p>
</div>
<VChart ref="chartRefP1" :option="optionP1" autoresize />
</div>
<div class="box-border pr-20px mx-20px h-130px bg-#F5F8FF p10px">
@ -243,7 +269,7 @@ const handleDateChange = (val:any) => {
<span class="text-18px font-bold text-#3164BF">{{ numberObj[n] }}</span
>
<span class="ml5px">使用量
<n-number-animation show-separator :from="0" :duration="300" :to="pieDecObj[`${n}1`]"/>碳排放量
<n-number-animation show-separator :from="0" :duration="300" :to="pieDecObj[`${n}1`]"/>千克碳排放量
<n-number-animation show-separator :from="0" :duration="300" :to="pieDecObj[`${n}2`]"/>
</span>
</div>

View File

@ -402,6 +402,12 @@ export function charData() {
label: {
show: false
}
// emphasis: {
// // 高亮样式
// itemStyle: {
// color: 'red'
// }
// }
},
{
name: 'DSZ',
@ -594,7 +600,7 @@ export function pieData1() {
orient: 'vertical',
data: [
{
name: '原材料使用量(',
name: '原材料使用量(千克',
itemStyle: { color: '#f8cbad', borderWidth: 0 }
},
{
@ -630,7 +636,7 @@ export function pieData1() {
series: [
{
center: ['50%', '56%'],
name: '原材料使用量(',
name: '原材料使用量(千克',
type: 'pie',
selectedMode: 'single',
radius: [0, '50%'],
@ -668,7 +674,7 @@ export function pieData1() {
center: ['50%', '56%'],
name: '原材料碳排放量(吨)',
type: 'pie',
radius: ['50%', '80%'],
radius: ['50%', '76%'],
avoidLabelOverlap: false,
itemStyle: {
// borderRadius: 10,

View File

@ -1,11 +1,12 @@
<script setup lang="ts">
import DataBaseHead from "@/views/home/components/DataBaseHead.vue";
import { cateAdd, cateUpdate, treeDbList, cateInfo, cateDel, cateFileUpdate, cateFileDel, cateFileList, download } from '@/api/daikin/base'
import { cateAdd, cateUpdate, treeDbList, cateInfo, cateDel, cateFileUpdate, cateFileDel, cateFileList, download,fetchdbAuthGetInfo } from '@/api/daikin/base'
import { useUserStore } from '@/stores/modules/user'
import { useMessage,NModal } from 'naive-ui'
const store = useUserStore()
const message = useMessage()
const userCode = ['admin','database_dandang','tech_service'].includes(store.user.roleCode) || !!store.user?.isDbUpload || !!store.user?.isDbReview
const userCode = ['admin','database_dandang'].includes(store.user.roleCode)
const user: any = store.user
const { push } = useRouter();
const title = ref("大金集团经营理念")
@ -23,7 +24,8 @@ watchEffect(()=>{
prop.cateId
prop.title
title.value = prop.title
getTree()
getTree()
getAuth()
})
const tableData = ref()
async function getTree() {
@ -149,6 +151,22 @@ function getFileNameFromUrl(url: string) {
}
}
//
const hasUpload = ref(false)
const hasReview = ref(false)
async function getAuth() {
if (!prop.cateId) return
const { data: uploadUser = [] } = await fetchdbAuthGetInfo({
cateId: prop.cateId,
type: 1
})
hasUpload.value = uploadUser.findIndex((x:any) => x.userId === user?.id) > -1
const { data: reviewUser = [] } = await fetchdbAuthGetInfo({
cateId: prop.cateId,
type: 2
})
hasReview.value = reviewUser.findIndex((x:any) => x.userId === user?.id) > -1
}
</script>
<template>
@ -179,7 +197,7 @@ function getFileNameFromUrl(url: string) {
<div class="h80px rd-t-15px bg-#4877FB leading-80px text-#fff text-20px">
<img src="@/assets/images/Shape7@2x.png" class="w50px ml-30px mr10px mt--20px" />
{{ title }}
<el-button v-if="userCode" class="float-right top-25px right-30px" type="primary" @click="push('/DataBase/Modify')"></el-button>
<el-button v-if=" userCode || hasUpload || hasReview" class="float-right top-25px right-30px" type="primary" @click="push('/DataBase/Modify')"></el-button>
</div>
<div class="p30px relative h790px">
<!-- lujinli -->
@ -206,9 +224,10 @@ function getFileNameFromUrl(url: string) {
<td class="w20% h50px">{{it.deptName}}</td>
<td class="w20% h50px">{{it.parentDeptName}}</td>
<td class="w20% h50px">{{it.createTime}}</td>
<td class="w16% h50px">
<el-button style="color: #000;" @click="openUrl(it)"></el-button>
<el-button style="color: #000;" @click="downloads(it)"></el-button>
<td class="w16% h50px text-center">
<!-- <el-button style="color: #000;" @click="openUrl(it)"></el-button> -->
<!-- <el-button style="color: #000;" @click="downloads(it)"></el-button> -->
<el-button style="color: #000;" @click="downloads(it)"></el-button>
</td>
</tr>
</tbody>

View File

@ -21,7 +21,7 @@
</div>
<el-tab-pane label="分类管理" name="first">
<div class="h-52px ">
<el-button type="primary" @click="editClickA('add')" class="mb-20px">
<el-button v-if="userCode" type="primary" @click="editClickA('add')" class="mb-20px">
新增
</el-button>
</div>
@ -720,6 +720,7 @@ const hasUpload = ref(false)
const setReview = ref(false)
const hasReview = ref(false)
async function getAuth() {
if (!cateIds.value) return
const { data: uploadUser = [] } = await fetchdbAuthGetInfo({
cateId: cateIds.value,
type: 1