main
王文龙 2023-12-15 18:12:46 +08:00
parent 4ce47123c8
commit 888f9af83b
11 changed files with 1644 additions and 1221 deletions

1
components.d.ts vendored
View File

@ -16,6 +16,7 @@ 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']

File diff suppressed because it is too large Load Diff

View File

@ -1,27 +1,21 @@
<script setup lang="ts">
import {
charData,
charData2,
pieData1,
} from './CSRDatas'
import { charData, charData2, pieData1 } from './CSRDatas'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
// const { chartRef, option } = charData()
// const { chartRef: chartRef1, option: option1 } = charData2()
// const { chartRef: chartRefP1, option: optionP1 } = pieData1()
import { NNumberAnimation,NDatePicker } from "naive-ui";
import { NNumberAnimation, NDatePicker } from 'naive-ui'
import { ref, onMounted } from 'vue'
import {
fetchStatListlBar,fetchStatListlPie
} from '@/api/daikin/base'
import { fetchStatListlBar, fetchStatListlPie } from '@/api/daikin/base'
const yearrange = ref([new Date(2020,0).valueOf(), new Date().valueOf()])
const yearrange = ref([new Date(2020, 0).valueOf(), new Date().valueOf()])
const pieYear = ref('20')
const option = ref<any>({});
const option1 = ref({});
const optionP1 = ref<any>({});
const chartRef = ref<any>(null);
const chartRef1 = ref(null);
const chartRefP1 = ref(null);
const option = ref<any>({})
const option1 = ref({})
const optionP1 = ref<any>({})
const chartRef = ref<any>(null)
const chartRef1 = ref(null)
const chartRefP1 = ref(null)
const locale = computed(() => zhCn)
const YearTime1 = ref<any>('2020')
const YearTime2 = ref<any>('2023')
@ -31,14 +25,14 @@ const cardsClick = (it) => {
console.log(flgs.value)
// dataInfo.treeSource = it
}
const numberObj:any ={
'Fe':'铁',
'Cu':'铜',
'Al':'铝',
'shuzhi':'树脂'
const numberObj: any = {
Fe: '铁',
Cu: '铜',
Al: '铝',
shuzhi: '树脂'
}
const numberList = ['Al','Fe','Cu','shuzhi']
const pieDecObj = ref<any>({});
const numberList = ['Al', 'Fe', 'Cu', 'shuzhi']
const pieDecObj = ref<any>({})
numberList.forEach((item) => {
pieDecObj.value[item + 1] = 0
pieDecObj.value[item + 2] = 0
@ -56,14 +50,14 @@ const getStatListlBar = async ([startYear, endYear] = [2020, 2023]) => {
for (let i = 0; i <= index; i++) {
const year = Number(startYear) + i
arr.push(year)
const item = data.find((it:any) => +it.year === year)
serieOne.push({value:item ? item.dis : 0,itemStyle:{}})
serieTwo.push({value:item ? item.dsz : 0,itemStyle:{}})
const item = data.find((it: any) => +it.year === year)
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
shadowBlur: 20
}
option.value.xAxis.data = arr
option.value.series[0].data = serieOne
@ -71,9 +65,12 @@ const getStatListlBar = async ([startYear, endYear] = [2020, 2023]) => {
}
const statListlPieData = ref([])
const pieUseTotalData = ref(0)
const pieDischargeTotal = ref(0)
const getStatListlPie = async ( year = option.value.xAxis.data || '2020', channel = 'DIS') => {
const pieUseTotalData = ref<any>(0)
const pieDischargeTotal = ref<any>(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
@ -84,29 +81,33 @@ const getStatListlPie = async ( year = option.value.xAxis.data || '2020', channe
year,
channel
})
data.forEach((item:any) => {
data.forEach((item: any) => {
pieDecObj.value[item.number + item.type] = item.negAmount
});
statListlPieData.value = data || []
optionP1.value.series[0].data = [];
optionP1.value.series[1].data = [];
optionP1.value.title.text = `【FY${pieYear.value}原材料构成数据】`
data?.length && numberList.forEach((item) => {
optionP1.value.series[0].data.push({
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
})
statListlPieData.value = data || []
optionP1.value.series[0].data = []
optionP1.value.series[1].data = []
optionP1.value.title.text = `【FY${pieYear.value}原材料构成数据】`
data?.length &&
numberList.forEach((item) => {
optionP1.value.series[0].data.push({
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
})
pieUseTotalData.value = Math.trunc(
(pieUseTotalData.value || 0) / 1000
).toLocaleString()
pieDischargeTotal.value = Math.trunc(pieDischargeTotal.value).toLocaleString()
}
onMounted( () => {
onMounted(() => {
const char = charData()
option.value = char.option.value
// chartRef.value = char.chartRef.value
@ -120,28 +121,28 @@ onMounted( () => {
getStatListlPie()
})
const chartClick = (it:any) => {
option.value.series.forEach((item:any) => {
item.data.forEach((i:any) => {
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
};
shadowBlur: 20
}
getStatListlPie(it.name, it.seriesName)
pieYear.value = (+it.name).toString().substring(2)
}
const handleDateChange = (val:any) => {
const handleDateChange = (val: any) => {
getStatListlBar(val)
}
</script>
<template>
<div class="flex w-full h-full rounded-18px">
<div class="flex w-full h-full rounded-18px">
<!-- <AppBlock class="w-full ">
<img src="./images/goudongxi3.png" class="w-full h-full" />
</AppBlock> -->
@ -178,7 +179,7 @@ const handleDateChange = (val:any) => {
>
季度
</div> -->
<!-- style="border-radius: 15px 15px 15px 0" -->
<!-- style="border-radius: 15px 15px 15px 0" -->
<div
class="w-90px ml-auto rounded-15px"
:class="flgs === 3 ? 'onStyle' : ''"
@ -188,7 +189,12 @@ const handleDateChange = (val:any) => {
</div>
</div>
<div class="w-full h-450px">
<VChart @click="chartClick" ref="chartRef" :option="option" autoresize />
<VChart
@click="chartClick"
ref="chartRef"
:option="option"
autoresize
/>
</div>
<!-- <div class="absolute top-91% flex items-center">
日期<el-config-provider :locale="locale">
@ -209,11 +215,19 @@ const handleDateChange = (val:any) => {
</el-config-provider>
</div> -->
<div class="absolute top-91% flex items-center">
日期<n-date-picker @update:formatted-value="handleDateChange" v-model:value="yearrange" type="yearrange" format="yyyy" size="small" />
日期<n-date-picker
@update:formatted-value="handleDateChange"
v-model:value="yearrange"
type="yearrange"
format="yyyy"
size="small"
/>
</div>
</div>
<div class="relative w-full bg-#fff h-38.5%">
<div class="absolute top-28px left-1/2 translate-[-50%] text-center text-#142142 text-22px py20px font-extrabold">
<div
class="absolute top-28px left-1/2 translate-[-50%] text-center text-#142142 text-22px py20px font-extrabold"
>
SMM牌号低碳铝价格&价差
</div>
<div class="w-full h-340px pt-4 relative">
@ -250,27 +264,49 @@ 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 pt20px pb-10px 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> -->
<!-- <div class="h-10px mt10px"> </div> -->
</div>
<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
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">
<div class="py5px" v-for="n in numberList" :key="n">
<!-- <n-number-animation show-separator :from="0" :to="10700"/>碳排放量159,158-->
<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}2`]"/>
<!-- <n-number-animation show-separator :from="0" :to="10700"/>碳排放量159,158-->
<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`] / 1000"
/>
<n-number-animation
show-separator
:from="0"
:duration="300"
:to="pieDecObj[`${n}2`]"
/>
</span>
</div>
</div>
@ -281,26 +317,22 @@ const handleDateChange = (val:any) => {
</div>
<div class="px20px py10px bg-#F5F8FF rd-5px">
<span class="text-#000 text-16px font-extrabold"> 现行铝</span
>
<span class="text-#000 text-16px font-extrabold"> 现行铝</span>
<!-- <span class="text-22px text-#265DD5 font-extrabold">0.000</span
><span> /</span> -->
</div>
<div class="px20px py10px bg-#F5F8FF rd-5px mt5px">
<span class="text-#000 text-16px font-extrabold"> 低碳铝</span
>
<span class="text-#000 text-16px font-extrabold"> 低碳铝</span>
<!-- <span class="text-22px text-#265DD5 font-extrabold">0.000</span
><span> /</span> -->
</div>
<div class="px20px py10px bg-#F5F8FF rd-5px mt5px">
<span class="text-#000 text-16px font-extrabold"> 碳价</span
>
<span class="text-#000 text-16px font-extrabold"> 碳价</span>
<!-- <span class="text-22px text-#265DD5 font-extrabold">0.000</span
><span> /</span> -->
</div>
<div class="px20px py10px bg-#F5F8FF rd-5px mt5px">
<span class="text-#000 text-16px font-extrabold"> 数据来源</span
>
<span class="text-#000 text-16px font-extrabold"> 数据来源</span>
<span class="text-#265DD5">行情展示 (cneeex.com)</span> <br />
<div class="ml-82px mt-6px">SMM网站</div>
</div>
@ -308,7 +340,10 @@ const handleDateChange = (val:any) => {
class="absolute flex flex-col w-full h-full z-200 top-0 left-0 text-center bg-red justify-center items-center"
style="background-color: rgba(255, 255, 255, 0.8)"
>
<img src="@/assets/images/chah.png" class="h-130px object-contain" />
<img
src="@/assets/images/chah.png"
class="h-130px object-contain"
/>
<br />
<div class="text-#5683DB text-36px">做成中,敬请期待</div>
</div>
@ -328,7 +363,7 @@ const handleDateChange = (val:any) => {
background: #ecf3ff;
}
}
:deep(.n-date-picker){
:deep(.n-date-picker) {
width: 200px !important;
}
</style>

View File

@ -1,8 +1,8 @@
import type { EChartsOption } from 'echarts'
import * as echarts from 'echarts'
import 'echarts-liquidfill';
import {getCSRDetail} from '@/api/daikin/base'
import { create } from 'naive-ui';
import 'echarts-liquidfill'
import { getCSRDetail } from '@/api/daikin/base'
import { create } from 'naive-ui'
import { xAxisD, dataA, dataB } from './testData'
export const Content2 = [
@ -600,7 +600,7 @@ export function pieData1() {
orient: 'vertical',
data: [
{
name: '原材料使用量(千克',
name: '原材料使用量(',
itemStyle: { color: '#f8cbad', borderWidth: 0 }
},
{
@ -619,7 +619,27 @@ export function pieData1() {
textStyle: { color: '#4075E1' }
},
tooltip: {
trigger: 'item'
trigger: 'item',
// formatter: '{a} <br/>{b} : {c} ({d}%)'
formatter: function (params: any) {
const title = `<p>${params.seriesName}</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.name +
': ' +
(params.componentIndex === 0
? Math.trunc(params.value / 1000).toLocaleString()
: params.value.toLocaleString()) +
'' +
params.percent +
'%'
)
}
},
grid: {
// left: '20',
@ -636,7 +656,7 @@ export function pieData1() {
series: [
{
center: ['50%', '56%'],
name: '原材料使用量(千克',
name: '原材料使用量(',
type: 'pie',
selectedMode: 'single',
radius: [0, '50%'],
@ -646,7 +666,10 @@ export function pieData1() {
label: {
position: 'inner',
fontSize: 16,
formatter: '{b}{c}'
// formatter: '{b}{c}'
formatter: function (params: any) {
return Math.trunc(params.data.value / 1000).toLocaleString()
}
},
labelLine: {
show: false
@ -693,7 +716,10 @@ export function pieData1() {
label: {
position: 'inner',
fontSize: 16,
formatter: '{b}{c}'
// formatter: '{b}{c}'
formatter: function (params: any) {
return Math.trunc(+params.data.value).toLocaleString()
}
// backgroundColor: '#F6F8FC',
// borderColor: '#8C8D8E',
// borderWidth: 1,
@ -808,81 +834,81 @@ export function pieData2() {
const gl = '10%'
export function liQuid() {
const chartRef = ref()
const option = ref({
title: {
text: '整体目标加' + gl,
// subtext: 'Fake Data',
left: 'center',
bottom: '-5px',
textStyle: { fontSize: '14px', fontWeight: '100' }
},
series: [{
type: 'liquidFill',
silent: true,
data: [0.76, 0.55, 0.62],
color: ['#41E5BA', '#B1D2FF', '#63E8C4'],
radius: '150px',
backgroundStyle: {
// borderWidth: 0,
// borderColor: 'red',
opacity: '0.4',
color: '#00D491'
// color:'#63E8C4'
},
outline: {
show: false
},
label: {
fontSize: 19,
fontColor: '#fff',
formatter: function (param) {
return '原材料' + '\n'+ '\n'
+ (param.value * 100) + '%';
},
}
}]
})
return { chartRef, option }
const chartRef = ref()
const option = ref({
title: {
text: '整体目标加' + gl,
// subtext: 'Fake Data',
left: 'center',
bottom: '-5px',
textStyle: { fontSize: '14px', fontWeight: '100' }
},
series: [
{
type: 'liquidFill',
silent: true,
data: [0.76, 0.55, 0.62],
color: ['#41E5BA', '#B1D2FF', '#63E8C4'],
radius: '150px',
backgroundStyle: {
// borderWidth: 0,
// borderColor: 'red',
opacity: '0.4',
color: '#00D491'
// color:'#63E8C4'
},
outline: {
show: false
},
label: {
fontSize: 19,
fontColor: '#fff',
formatter: function (param) {
return '原材料' + '\n' + '\n' + param.value * 100 + '%'
}
}
}
]
})
return { chartRef, option }
}
export function liQuids() {
const chartRef = ref()
const option = ref({
title: {
text: '整体目标加' + gl,
// subtext: 'Fake Data',
left: 'center',
bottom: '-5px',
textStyle: { fontSize: '14px', fontWeight: '100' }
},
series: [{
type: 'liquidFill',
silent: true,
data: [0.8, 0.65, 0.72],
color: ['#8CBEFF', '#B1D2FF', '#8CBEFF'],
radius: '150px',
backgroundStyle: {
// borderWidth: 0,
// borderColor: 'red',
opacity: '0.6',
color: '#1D88FF'
// color:'#63E8C4'
},
outline: {
show: false
},
label: {
fontSize: 19,
fontColor: '#fff',
formatter: function (param) {
return '能源消耗' + '\n'+ '\n'
+ (param.value * 100) + '%';
},
}
}]
})
return { chartRef, option }
}
const chartRef = ref()
const option = ref({
title: {
text: '整体目标加' + gl,
// subtext: 'Fake Data',
left: 'center',
bottom: '-5px',
textStyle: { fontSize: '14px', fontWeight: '100' }
},
series: [
{
type: 'liquidFill',
silent: true,
data: [0.8, 0.65, 0.72],
color: ['#8CBEFF', '#B1D2FF', '#8CBEFF'],
radius: '150px',
backgroundStyle: {
// borderWidth: 0,
// borderColor: 'red',
opacity: '0.6',
color: '#1D88FF'
// color:'#63E8C4'
},
outline: {
show: false
},
label: {
fontSize: 19,
fontColor: '#fff',
formatter: function (param) {
return '能源消耗' + '\n' + '\n' + param.value * 100 + '%'
}
}
}
]
})
return { chartRef, option }
}

View File

@ -1,39 +1,56 @@
<script setup lang="ts">
import DataBaseHead from "@/views/home/components/DataBaseHead.vue";
import { cateAdd, cateUpdate, treeDbList, cateInfo, cateDel, cateFileUpdate, cateFileDel, cateFileList, download,fetchdbAuthGetInfo } from '@/api/daikin/base'
import DataBaseHead from '@/views/home/components/DataBaseHead.vue'
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()
import { useMessage, NModal } from 'naive-ui'
const store: any = useUserStore()
const message = useMessage()
const userCode = ['admin','database_dandang'].includes(store.user.roleCode)
const userCode = ['admin', 'database_dandang'].includes(store.user.roleCode)
const isDbReview = store.user?.isDbReview === 1
const isDbUpload = store.user?.isDbUpload === 1
const user: any = store.user
const { push } = useRouter();
const title = ref("大金集团经营理念")
const { push } = useRouter()
const title = ref('大金集团经营理念')
const prop = defineProps({
cateId: Number,
title:String
const prop = defineProps({
cateId: Number,
title: String
})
const pageInfo = reactive({
currentPage:1,
pageSize:13,
total:10
currentPage: 1,
pageSize: 13,
total: 10
})
watchEffect(()=>{
prop.cateId
prop.title
title.value = prop.title
getTree()
getAuth()
watchEffect(() => {
prop.cateId
prop.title
title.value = prop.title
getTree()
// getAuth()
})
const tableData = ref()
async function getTree() {
const {currentPage,pageSize} = pageInfo
if(!prop.cateId) return
const {rows,total} = await cateFileList({cateId:prop.cateId,pageNum:currentPage,pageSize})
pageInfo.total =total
tableData.value = rows
const { currentPage, pageSize } = pageInfo
if (!prop.cateId) return
const { rows, total } = await cateFileList({
cateId: prop.cateId,
pageNum: currentPage,
pageSize
})
pageInfo.total = total
tableData.value = rows
}
// async function downloads(row) {
// console.log(row)
@ -46,7 +63,7 @@ async function getTree() {
// const response = await download({ id: row.id })
// console.log(response)
// var blob = new Blob([response.data]);
// const downloadUrl = URL.createObjectURL(blob);
// const link = document.createElement('a');
// link.href = downloadUrl;
@ -58,73 +75,89 @@ async function getTree() {
// // message.error('', error);
// }
// }
async function downloads(row:any) {
console.log(row,'!!!!!!!!!!xiazai')
const {isSelect,filePath} = row
if(isSelect === 2) {
message.info("没有访问权限")
return
}
// try{
// downloadFile(filePath)
// }catch(error){
// }
window.open(filePath)
async function downloads(row: any) {
console.log(row, '!!!!!!!!!!xiazai')
const { isSelect, filePath } = row
if (isSelect === 2) {
message.info('没有访问权限')
return
}
// try{
// downloadFile(filePath)
// }catch(error){
// }
// window.open(
// 'https://view.officeapps.live.com/op/view.aspx?src=' +
// encodeURIComponent(filePath)
// )
filePath && window.open(filePath)
}
const lazyState = computed(() => [pageInfo.currentPage])
watch(
() => unref(lazyState),
async (v) => {
getTree()
},
{ immediate: true, deep: true },
)
watch(
() => unref(lazyState),
async (v) => {
getTree()
},
{ immediate: true, deep: true }
)
const handleSizeChange=(e)=>{
console.log(e)
const handleSizeChange = (e) => {
console.log(e)
}
const handleCurrentChange=(e)=>{
console.log(e)
const handleCurrentChange = (e) => {
console.log(e)
}
//
const srcType = ref()
const src = ref()
const pdfShow = ref(false)
const showModalRef2 =ref(false)
const openUrl = async (it)=>{
console.log(it,2222)
let {filePath,isSelect} = it
if(isSelect === 2) {
message.info("没有访问权限")
return
}
if(!filePath) {
message.info("没有可预览文件!")
return
}
srcType.value = getLastSubstring(filePath)
if(['doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx','pdf'].includes(srcType.value)){
// src.value = filePath
// pdfShow.value = true
filePath='https://view.xdocin.com/view?src='+filePath
const screenWidth = window.screen.width;
const screenHeight = window.screen.height;
window.open(filePath, '', 'width=' + screenWidth + ',height=' + screenHeight + ',top=' + 0 + ',left=' + 0)
}
else{
message.error("文件格式不是 'doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx','pdf'")
}
const showModalRef2 = ref(false)
const openUrl = async (it) => {
console.log(it, 2222)
let { filePath, isSelect } = it
if (isSelect === 2) {
message.info('没有访问权限')
return
}
if (!filePath) {
message.info('没有可预览文件!')
return
}
srcType.value = getLastSubstring(filePath)
if (
['doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx', 'pdf'].includes(srcType.value)
) {
// src.value = filePath
// pdfShow.value = true
filePath = 'https://view.xdocin.com/view?src=' + filePath
const screenWidth = window.screen.width
const screenHeight = window.screen.height
window.open(
filePath,
'',
'width=' +
screenWidth +
',height=' +
screenHeight +
',top=' +
0 +
',left=' +
0
)
} else {
message.error(
"文件格式不是 'doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx','pdf'"
)
}
}
function getLastSubstring(str: string): string {
const lastIndex = str.lastIndexOf('.');
if (lastIndex !== -1) {
return str.substring(lastIndex + 1);
} else {
return '';
}
const lastIndex = str.lastIndexOf('.')
if (lastIndex !== -1) {
return str.substring(lastIndex + 1)
} else {
return ''
}
}
function downloadFile(url: any) {
fetch(url)
@ -143,37 +176,37 @@ function getFileName(url: string) {
return url.slice(lastSplashIndex + 1, lastDotIndex)
}
function getFileNameFromUrl(url: string) {
const lastSlashIndex = url.lastIndexOf("/");
if (lastSlashIndex !== -1) {
return url.substring(lastSlashIndex + 1);
} else {
return "Invalid URL";
}
const lastSlashIndex = url.lastIndexOf('/')
if (lastSlashIndex !== -1) {
return url.substring(lastSlashIndex + 1)
} else {
return 'Invalid URL'
}
}
//
const hasUpload = ref(false)
const hasReview = ref(false)
async function getAuth() {
if (!prop.cateId) return
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
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
hasReview.value = reviewUser.findIndex((x: any) => x.userId === user?.id) > -1
}
</script>
<template>
<DataBaseHead />
<div class="w-full h-1px bg-#507FFD mt50px rd-b-20px"></div>
<div class="w-full h-95%">
<!-- <div class="px30px flex text-center py40px">
<DataBaseHead />
<div class="w-full h-1px bg-#507FFD mt50px rd-b-20px"></div>
<div class="w-full h-95%">
<!-- <div class="px30px flex text-center py40px">
<div class="bg-#6C93F8 text-#fff px20px pt18px pb-15px w-180px rd-10px mr-15px">
<img src="@/assets/images/xinxi@2x.png" class="w30px mr-5px mt--3px" /><span>公司经营信息</span>
</div>
@ -192,69 +225,130 @@ async function getAuth() {
</div> -->
<div class="bg-#fff rd-15px px30px pt30px w-full h930px ">
<div class=" rd-15px w-full h870px " style="box-shadow: 1px 2px 26px -3px #cdcccc;">
<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 || hasUpload || hasReview" class="float-right top-25px right-30px" type="primary" @click="push('/DataBase/Modify')"></el-button>
</div>
<div class="p30px relative h790px">
<!-- lujinli -->
<!-- <table class="history w-full text-center text-16px border-spacing-0 "> -->
<table class="history w-full text-center text-18px border-spacing-0 ">
<thead
style="background-color: #E7EDFF;color: #000;height: 50px;width: 220px; border: 1px solid #417BEF;">
<tr class="text-20px leading-50px">
<th width="20%"><img src="@/assets/images/baiot@2x.png" class="w35px mt--7px mr-5px" />标题</th>
<th width="20%"><img src="@/assets/images/scbmm@2x.png" class="w35px mt--7px mr-5px" />上传科室</th>
<th width="20%"><img src="@/assets/images/scbmm@2x.png" class="w35px mt--7px mr-5px" />上传部门</th>
<th width="20%"><img src="@/assets/images/riqii@2x.png" class="w35px mt--7px mr-5px" />上传日期</th>
<th width="16%">操作</th>
</tr>
</thead>
<tbody class=" h650px overflow-auto absolute w100% ">
<tr class="w-full flex leading-50px" v-for="it in tableData">
<td class="w20% h50px cursor-pointer overflow-hidden text-left pl25px truncate text-#000" >
<span :title="it.title" > {{it.title}}</span>
</td>
<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 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>
</table>
<div class="float-right absolute bottom-20px right-30px">
<el-pagination v-model:current-page="pageInfo.currentPage" v-model:page-size="pageInfo.pageSize"
layout="prev, pager, next, jumper" :total="pageInfo.total"
@size-change="handleSizeChange" @current-change="handleCurrentChange" />
</div>
</div>
</div>
</div>
</div>
<n-modal v-model:show="pdfShow">
<div class="w100% h100% ">
<el-icon color="#fff" size="26px" @click="pdfShow=false" class="absolute left-92% bg-#F43"><Close /></el-icon>
<Amtion :data="src" :datas="srcType" />
</div>
</n-modal>
<div class="bg-#fff rd-15px px30px pt30px w-full h930px">
<div
class="rd-15px w-full h870px"
style="box-shadow: 1px 2px 26px -3px #cdcccc"
>
<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 }}
<div class="float-right top-0 right-30px">
<el-button
class="mr-30px"
v-if="isDbReview || isDbUpload || userCode"
type="warning"
@click="push({ path: '/DataBase/review' })"
>
审批流程
</el-button>
<el-button
v-if="isDbReview || isDbUpload || userCode"
type="primary"
@click="push('/DataBase/Modify')"
>内容管理</el-button
>
</div>
</div>
<div class="p30px relative h790px">
<!-- lujinli -->
<!-- <table class="history w-full text-center text-16px border-spacing-0 "> -->
<table class="history w-full text-center text-18px border-spacing-0">
<thead
style="
background-color: #e7edff;
color: #000;
height: 50px;
width: 220px;
border: 1px solid #417bef;
"
>
<tr class="text-20px leading-50px">
<th width="20%">
<img
src="@/assets/images/baiot@2x.png"
class="w35px mt--7px mr-5px"
/>
</th>
<th width="20%">
<img
src="@/assets/images/scbmm@2x.png"
class="w35px mt--7px mr-5px"
/>
</th>
<th width="20%">
<img
src="@/assets/images/scbmm@2x.png"
class="w35px mt--7px mr-5px"
/>
</th>
<th width="20%">
<img
src="@/assets/images/riqii@2x.png"
class="w35px mt--7px mr-5px"
/>
</th>
<th width="20% text-center">操作</th>
</tr>
</thead>
<tbody class="h650px overflow-auto absolute w-full">
<tr class="w-full flex leading-50px" v-for="it in tableData">
<td
class="w20% h50px cursor-pointer overflow-hidden text-left pl25px truncate text-#000"
>
<span :title="it.title"> {{ it.title }}</span>
</td>
<td class="w20% h50px">{{ it.deptName }}</td>
<td class="w20% h50px">{{ it.parentDeptName }}</td>
<td class="w20% h50px">{{ it.createTime }}</td>
<td class="w20% h50px">
<!-- <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>
</table>
<div class="float-right absolute bottom-20px right-30px">
<el-pagination
v-model:current-page="pageInfo.currentPage"
v-model:page-size="pageInfo.pageSize"
layout="prev, pager, next, jumper"
:total="pageInfo.total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
</div>
</div>
</div>
</div>
<n-modal v-model:show="pdfShow">
<div class="w100% h100%">
<el-icon
color="#fff"
size="26px"
@click="pdfShow = false"
class="absolute left-92% bg-#F43"
><Close
/></el-icon>
<Amtion :data="src" :datas="srcType" />
</div>
</n-modal>
</template>
<style>
.truncate {
display: block;
/* max-width: 226px; */
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}</style>
display: block;
/* max-width: 226px; */
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
</style>

View File

@ -1,11 +1,12 @@
<script setup lang="ts">
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 { treeDbList, download } from '@/api/daikin/base'
import { databaseld } from '@/stores/modules/database'
import { NPopover } from 'naive-ui'
const { push } = useRouter()
const route = useRoute()
const store = useUserStore()
const database = databaseld()
const { toggle } = inject<any>('fullscreen')
@ -14,242 +15,290 @@ let idx = ref(0)
const onClic = ref(false)
const titles = ref()
function menuHandler(menu: any, index: number) {
console.log(menu,index)
activeMenuKey.value = menu.id
titles.value = menu.name
idx.value = index;
activeItem.value = menu.id
if (menu.childList&&menu.childList.length>0){
activeItem.value = menu.childList[0].id
}
database.database.id =activeItem.value
console.log(menu, index)
activeMenuKey.value = menu.id
titles.value = menu.name
idx.value = index
activeItem.value = menu.id
if (menu.childList && menu.childList.length > 0) {
activeItem.value = menu.childList[0].id
}
database.database.id = activeItem.value
goListPage()
}
function goChild(menu: any) {
activeItem.value = menu.id
console.log(menu.id)
database.database.id =menu.id
activeItem.value = menu.id
console.log(menu.id)
database.database.id = menu.id
goListPage()
}
function goListPage() {
const { path } = route
if (path === '/DataBase/review') push('/DataBase')
}
var activeItem = ref<any>()
const tableData = ref()
async function getTree() {
const { data = [] } = await treeDbList({})
tableData.value = data
if(data&&data[0]){
// console.log(data[0])
titles.value = data[0].name
activeMenuKey.value = data[0].id
database.database.id = data[0].id
// if(data[0].childList&&data[0].childList.length>0){
// activeItem.value = data[0].childList[0].id
// 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)
})
}
}
const { data = [] } = await treeDbList({})
tableData.value = data
if (data && data[0]) {
// console.log(data[0])
titles.value = data[0].name
activeMenuKey.value = data[0].id
database.database.id = data[0].id
// if(data[0].childList&&data[0].childList.length>0){
// activeItem.value = data[0].childList[0].id
// 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)
})
}
}
}
getTree()
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};
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>
<div class="page w-1920px h-1080px flex">
<div class="w350px -mr-1px flex flex-col shrink-0 overflow-auto">
<div class="p30px bg-#000 ">
<!-- @dblclick="toggle" -->
<img src="@/assets/images/logo@2x.png" class="w197px h44px mt14px" />
</div>
<div class="page w-1920px h-1080px flex">
<div class="w350px -mr-1px flex flex-col shrink-0 overflow-auto">
<div class="p30px bg-#000">
<!-- @dblclick="toggle" -->
<img src="@/assets/images/logo@2x.png" class="w197px h44px mt14px" />
</div>
<div class="pt30px pb24px flex-1 pl20px bg-#fff">
<div class="nav px36px py24px m10px mr0 rd-32px rd-r-0 flex flex-col text-#000 cursor-pointer"
v-for="(m, index) in tableData" :key="m.id" :class="activeMenuKey === m.id ? (m.childList ? 'actives' : 'active') : ''"
@click="() => menuHandler(m, index)">
<div :class="activeMenuKey === m.id && 'onActive'" class="flex" @click="onClic=!onClic">
<!-- <img v-if="activeMenuKey === m.id" :src="m.icon1" class="w22px h22px mr16px mt--5px" />
<div class="pt30px pb24px flex-1 pl20px bg-#fff">
<div
class="nav px36px py24px m10px mr0 rd-32px rd-r-0 flex flex-col text-#000 cursor-pointer"
v-for="(m, index) in tableData"
:key="m.id"
:class="
activeMenuKey === m.id ? (m.childList ? 'actives' : 'active') : ''
"
@click="() => menuHandler(m, index)"
>
<div
:class="activeMenuKey === m.id && 'onActive'"
class="flex"
@click="onClic = !onClic"
>
<!-- <img v-if="activeMenuKey === m.id" :src="m.icon1" class="w22px h22px mr16px mt--5px" />
<img v-else :src="m.icon" class="w22px h22px mr16px mt--5px" /> -->
<!-- lujinli -->
<!-- <span class="text-17px font-900 relative min-w195px block"> -->
<span class="text-18px font-900 relative min-w195px block">
<span class="truncate"> {{ m.name }} </span>
<span class="text-#000000 absolute right--30px top--5px"><el-icon size="26">
<CaretTop v-if="activeMenuKey === m.id&&onClic" class="text-#4977FC" />
<CaretBottom v-else />
</el-icon></span>
</span>
</div>
<!-- lujinli -->
<!-- <span class="text-17px font-900 relative min-w195px block"> -->
<span class="text-18px font-900 relative min-w195px block">
<span class="truncate"> {{ m.name }} </span>
<span class="text-#000000 absolute right--30px top--5px"
><el-icon size="26">
<CaretTop
v-if="activeMenuKey === m.id && onClic"
class="text-#4977FC"
/>
<CaretBottom v-else /> </el-icon
></span>
</span>
</div>
<div v-if="m.childList && idx == index" class="pl40px" v-show="idx === index&&onClic?true:false">
<div class="my30px pl10px text-#000 activeChildren" v-for="(item, ind) in m.childList" :key="item.id"
@click.stop="goChild(item)" @click="activeItem = item.id" >
<!-- <el-tooltip :content="item.name" placement="top-start" effect="light"> -->
<n-popover trigger="hover" placement="top-start">
<template #trigger>
<span class="text-18px flex child font-900 truncate" :class="activeItem === item.id ? 'text-#002fa7' : ''">{{ item.name }}</span>
</template>
<div class="text-18px leading-40px">
{{ item.name }}
</div>
</n-popover>
<!-- </el-tooltip> -->
<div
v-if="m.childList && idx == index"
class="pl40px"
v-show="idx === index && onClic ? true : false"
>
<div
class="my30px pl10px text-#000 activeChildren"
v-for="(item, ind) in m.childList"
:key="item.id"
@click.stop="goChild(item)"
@click="activeItem = item.id"
>
<!-- <el-tooltip :content="item.name" placement="top-start" effect="light"> -->
<n-popover trigger="hover" placement="top-start">
<template #trigger>
<span
class="text-18px flex child font-900 truncate"
:class="activeItem === item.id ? 'text-#002fa7' : ''"
>{{ item.name }}</span
>
</template>
<div class="text-18px leading-40px">
{{ item.name }}
</div>
</n-popover>
<!-- </el-tooltip> -->
<div v-if="item.childList && idx == index" class="pl10px">
<div
class="my30px pl10px text-#000"
v-for="(ite, ind) in item.childList"
:key="item.id"
@click.stop="goChild(ite)"
@click="activeItem = ite.id"
>
<n-popover trigger="hover" placement="top-start">
<template #trigger>
<span
class="text-18px flex childs font-900 truncate"
:class="activeItem === ite.id ? 'text-#002fa7' : ''"
>{{ ite.name }}</span
>
</template>
<div class="text-18px leading-40px">
{{ ite.name }}
</div>
</n-popover>
<div v-if="item.childList && idx == index" class="pl10px">
<div class="my30px pl10px text-#000 " v-for="(ite, ind) in item.childList" :key="item.id"
@click.stop="goChild(ite)" @click="activeItem = ite.id">
<n-popover trigger="hover" placement="top-start">
<template #trigger>
<span class="text-18px flex childs font-900 truncate" :class="activeItem === ite.id ? 'text-#002fa7' : ''">{{ ite.name }}</span>
</template>
<div class="text-18px leading-40px">
{{ ite.name }}
</div>
</n-popover>
<div v-if="ite.childList && idx == index" class="pl10px">
<div class="my30px pl10px text-#000 " v-for="(it, ind) in ite.childList" :key="item.id"
@click.stop="goChild(it)" @click="activeItem = it.id">
<n-popover trigger="hover" placement="top-start">
<template #trigger>
<span class="text-18px flex childs font-900 truncate" :class="activeItem === it.id ? 'text-#002fa7' : ''">{{ it.name }}</span>
</template>
<div class="text-18px leading-40px">
{{ it.name }}
</div>
</n-popover>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div v-if="ite.childList && idx == index" class="pl10px">
<div
class="my30px pl10px text-#000"
v-for="(it, ind) in ite.childList"
:key="item.id"
@click.stop="goChild(it)"
@click="activeItem = it.id"
>
<n-popover trigger="hover" placement="top-start">
<template #trigger>
<span
class="text-18px flex childs font-900 truncate"
:class="activeItem === it.id ? 'text-#002fa7' : ''"
>{{ it.name }}</span
>
</template>
<div class="text-18px leading-40px">
{{ it.name }}
</div>
</n-popover>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="main flex-1 pb15px pt0px relative ">
<!-- <Home /> -->
<RouterView :cateId="activeItem" :title="titles"/>
</div>
</div>
<div class="main flex-1 pb15px pt0px relative">
<!-- <Home /> -->
<RouterView :cateId="activeItem" :title="titles" />
</div>
</div>
</template>
<style scoped lang="less">
.truncate {
display: block;
max-width: 226px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
display: block;
max-width: 226px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.page {
font-family: 'PingFang SC';
user-select: none;
background-image:none;
background-color: #cacaca;
background-position: 0 0;
background-repeat: no-repeat;
background-size: cover;
// color: #3b3b3b;
color: #000;
font-family: 'PingFang SC';
user-select: none;
background-image: none;
background-color: #cacaca;
background-position: 0 0;
background-repeat: no-repeat;
background-size: cover;
// color: #3b3b3b;
color: #000;
line-height: 1;
line-height: 1;
}
.nav {
&::before {
top: -48px;
}
.child:hover {
text-decoration: underline;
}
.childs:hover {
text-decoration: underline;
}
&::after {
bottom: -49px;
transform: rotate(-90deg);
}
&::before {
top: -48px;
}
.child:hover {
text-decoration: underline;
}
.childs:hover {
text-decoration: underline;
}
&.active {
color: #002fa7;
background-color: #e6ecff;
&::after {
bottom: -49px;
transform: rotate(-90deg);
}
a {
color: #002fa7;
}
&.active {
color: #002fa7;
background-color: #E6ECFF;
&::before,
&::after {
opacity: 1;
}
}
a {
color: #002fa7;
}
&.actives {
padding: 0px !important;
color: #4977fc;
background-color: #f5f8ff;
&::before,
&::after {
opacity: 1;
}
}
a {
color: #002fa7;
}
&.actives {
padding: 0px !important;
color: #4977FC;
background-color: #F5F8FF;
&::before,
&::after {
opacity: 1;
}
a {
color: #002fa7;
}
.onActive {
background-color: #e6ecff;
border-radius: 32px 0 0 32px;
&::before,
&::after {
opacity: 1;
}
.onActive {
background-color: #E6ECFF;
border-radius: 32px 0 0 32px;
padding: 24px 36px 24px 36px;
}
}
padding: 24px 36px 24px 36px;
}
}
}
.main {
width: 100%;
height: 95%;
background-color: #4877FB;
margin-left: 30px;
width: 100%;
height: 95%;
background-color: #4877fb;
margin-left: 30px;
}
&::-webkit-scrollbar {
display: none;
scrollbar-width: none
}</style>
display: none;
scrollbar-width: none;
}
</style>

View File

@ -6,7 +6,7 @@
<el-tabs v-model="activeName" class="demo-tabs">
<div class="absolute z-200 right-0 flex items-center">
<el-button
v-if="hasReview || hasUpload"
v-if="isDbUpload || isDbReview"
type="warning"
@click="handleClick"
>
@ -20,8 +20,13 @@
</div>
</div>
<el-tab-pane label="分类管理" name="first">
<div class="h-52px ">
<el-button v-if="userCode" type="primary" @click="editClickA('add')" class="mb-20px">
<div class="h-52px">
<el-button
v-if="userCode"
type="primary"
@click="editClickA('add')"
class="mb-20px"
>
新增
</el-button>
</div>
@ -87,41 +92,41 @@
</div>
</el-tab-pane>
<el-tab-pane label="内容管理" name="second">
<div class="h-52px ">
<el-button
v-if="hasUpload"
type="primary"
@click="editClickB('add')"
class="mb-20px"
>
新增</el-button
>
<el-button
v-if="userCode"
type="primary"
@click="getAll"
class="mb-20px"
>
查看所有</el-button
>
<el-button
v-if="userCode"
:type="setUpload ? 'success' : 'warning'"
:icon="setUpload ? 'Check' : ''"
@click="getUser({ type: 1 })"
class="mb-20px !ml-50px"
>
{{ setUpload ? '已设置上传人员' : '设置上传人员' }}</el-button
>
<el-button
v-if="userCode"
:type="setReview ? 'success' : 'warning'"
:icon="setReview ? 'Check' : ''"
@click="getUser({ type: 2 })"
class="mb-20px"
>
{{ setReview ? '已设置审批人员' : '设置审批人员' }}</el-button
>
<div class="h-52px">
<el-button
v-if="isDbReview || isDbUpload"
type="primary"
@click="editClickB('add')"
class="mb-20px"
>
新增</el-button
>
<el-button
v-if="userCode"
type="primary"
@click="getAll"
class="mb-20px"
>
查看所有</el-button
>
<el-button
v-if="userCode"
:type="setUpload ? 'success' : 'warning'"
:icon="setUpload ? 'Check' : ''"
@click="getUser({ type: 1 })"
class="mb-20px !ml-50px"
>
{{ setUpload ? '已设置上传人员' : '设置上传人员' }}</el-button
>
<el-button
v-if="userCode"
:type="setReview ? 'success' : 'warning'"
:icon="setReview ? 'Check' : ''"
@click="getUser({ type: 2 })"
class="mb-20px"
>
{{ setReview ? '已设置审批人员' : '设置审批人员' }}</el-button
>
</div>
<div class="w100% h750px overflow-auto">
<el-table
@ -166,30 +171,37 @@
show-overflow-tooltip
/>
<!-- <el-table-column label="排序" prop="sort" show-overflow-tooltip/> -->
<el-table-column
label="查看范围"
prop="userIdList"
>
<el-table-column label="查看范围" prop="userIdList">
<template #default="scope">
<!-- <el-button type="primary" class="button" @click="getUser(scope.row)"></el-button> -->
<!-- <span class="descStyle" v-if="scope.row.userList" v-for="it in scope.row.userList"> &nbsp;&nbsp; {{it.nickName}}</span> -->
<!-- <span>{{ scope.row.userList }}</span> -->
<p v-if="scope.row.userList.length" >
<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' : 'xx'">
{{ it.nickName || undefined }}
<span v-if="e == 1 && scope.row.userList.length > 2"
>...{{ scope.row.userList.length }}</span
>
</p>
</div>
</div>
</el-tooltip>
</p>
<span v-else>''</span>
<p v-if="scope.row.userList.length">
<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'
: 'xx'
"
>
{{ it.nickName || undefined }}
<span v-if="e == 1 && scope.row.userList.length > 2"
>...{{ scope.row.userList.length }}</span
>
</p>
</div>
</div>
</el-tooltip>
</p>
<span v-else>''</span>
</template>
</el-table-column>
<el-table-column
@ -198,7 +210,7 @@
show-overflow-tooltip
>
<template #default="scope">
<div>
<div v-if="userCode || hasUpload || hasReview">
<el-button
type="primary"
@click="editClickB('edit', scope.row)"
@ -207,7 +219,6 @@
编辑</el-button
>
<el-button
v-if="userCode || hasUpload"
type="danger"
@click="deleteClickB(scope.row)"
class="mb-20px w45px"
@ -286,15 +297,15 @@
<el-input v-model="editB.sort" type="number" />
</el-form-item>
<br />
<!-- <el-form-item label="所属类别">
<el-form-item label="所属类别">
<el-cascader
v-model="editB.cateId"
:options="tableData"
:modelValue="editB.cateIds"
:options="tableDataAuth"
@change="handleChange"
:props="{ children: 'childList', label: 'name', value: 'id' }"
/>
</el-form-item>
<br /> -->
<br />
<el-form-item label="查看范围">
<el-button
class="button"
@ -352,21 +363,23 @@ import {
download,
dragFile,
fetchdbAuthAdd,
fetchdbAuthGetInfo
fetchdbAuthGetInfo,
fetchReviewAuthCateList
} from '@/api/daikin/base'
import { NModal, useMessage, NSelect } from 'naive-ui'
import UserList from '@/views/home/intelligence/process/UserPages.vue'
import { databaseld } from '@/stores/modules/database'
const { push } = useRouter();
const { push } = useRouter()
const database = databaseld()
const store = useUserStore()
const store: any = useUserStore()
const message = useMessage()
const userCode = ['admin', 'database_dandang'].includes(
store.user.roleCode
)
const userCode = ['admin', 'database_dandang'].includes(store.user.roleCode)
const isDbReview = store.user?.isDbReview === 1
const isDbUpload = store.user?.isDbUpload === 1
const tableData = ref()
const tableData = ref([])
const tableDataAuth = ref([])
const infoData = ref()
const shomkA = ref(false)
@ -382,6 +395,9 @@ const pageInfo = reactive({
async function getTree() {
const { data } = await treeDbList({})
tableData.value = data
console.log('🚀 ~ file: modify.vue:399 ~ data:', data)
const { data: auth = [] } = await fetchReviewAuthCateList()
tableDataAuth.value = auth
}
let cateIds = ref()
watchEffect(() => {
@ -462,7 +478,7 @@ async function addClickA(row: any) {
shomkA.value = false
getTree()
}
const editClickB = (edit: any, obj: any) => {
const editClickB = (edit: any, obj: any = {}) => {
console.log(obj)
if (edit === 'add' && obj && obj.id) {
editB.value = {
@ -515,6 +531,14 @@ const editClickB = (edit: any, obj: any) => {
editB.value.cateId = database.database.id
userData.value = false
console.log(editB.value)
editB.cateIds = []
let ids: any[] = getParentIds(obj.cateId)
if (ids?.length > 0) {
ids = ids.reverse()
// ids.push(obj.cateId)
editB.value.cateIds = ids
console.log('🚀 ~ file: Process.vue:248 ~ ids:', ids)
}
shomkB.value = true
}
const deleteClickB = async (row: any) => {
@ -726,21 +750,34 @@ async function getAuth() {
type: 1
})
setUpload.value = uploadUser.length > 0
hasUpload.value = uploadUser.findIndex((x:any) => x.userId === store.user?.id) > -1
hasUpload.value =
uploadUser.findIndex((x: any) => x.userId === store.user?.id) > -1
const { data: reviewUser = [] } = await fetchdbAuthGetInfo({
cateId: cateIds.value,
type: 2
})
setReview.value = reviewUser.length > 0
hasReview.value = reviewUser.findIndex((x:any) => x.userId === store.user?.id) > -1
hasReview.value =
reviewUser.findIndex((x: any) => x.userId === store.user?.id) > -1
}
const handleClick = () => {
console.log(cateIds.value)
push({path:'/DataBase/review',query:{cateId:cateIds.value}})
console.log(cateIds.value)
push({ path: '/DataBase/review', query: { cateId: cateIds.value } })
}
const handTooltip = (data: any[] = []) => {
return data.map((item:any) => item.nickName)?.join(', ') || undefined
return data.map((item: any) => item.nickName)?.join(', ') || undefined
}
// ID ID
function getParentIds(id: number, list: any[] = tableData.value): any {
if (!id) return
for (let i in list) {
if (list[i].id == id) return [list[i].id]
if (list[i].childList) {
let node = getParentIds(id, list[i].childList)
if (node !== undefined) return node.concat(list[i].id)
}
}
}
</script>
<style lang="less" scoped>

View File

@ -1,6 +1,10 @@
<script setup lang="ts">
import HomeHead from '@/views/home/components/HomeHead.vue'
import { timeStat,externalTimeStat } from '@/api/daikin/base'
import {
timeStat,
externalTimeStat,
fetchmoduleStatExternalPage
} from '@/api/daikin/base'
import { formatDate } from '@/utils/format'
import { Chart1 } from './indexData'
import zhCn from 'element-plus/lib/locale/lang/zh-cn'
@ -12,19 +16,52 @@ const value1 = ref<[Date, Date]>([
new Date()
])
const states = reactive<any>({
startTime:formatDate(value1.value[0]).substring(0,10),
endTime: formatDate(value1.value[1]).substring(0,10),
// timeType:2,
startTime: formatDate(value1.value[0]).substring(0, 10),
endTime: formatDate(value1.value[1]).substring(0, 10)
// timeType:2,
})
const chartRef1 = ref()
const chartRef2 = ref()
const chartOption1 = ref({});
const chartOption2 = ref({});
const chartOption1 = ref({})
const chartOption2 = ref({})
const primary = ref(1)
const primarys = ref(2)
const activeName = ref('inside')
const pageInfo = reactive({
currentPage: 1,
pageSize: 10,
total: 10
})
const moduleCode = ref()
const visitDay = ref()
const waibuKd = ref()
const inseideDetail = ref([])
const outDetail = ref([])
const getInsideListPage = async () => {
const res: any = await fetchmoduleStatExternalPage({
waibuKd: waibuKd.value,
visitDay: visitDay.value,
moduleCode: moduleCode.value,
pageNum: pageInfo.currentPage,
pageSize: pageInfo.pageSize
})
inseideDetail.value = res?.rows || []
pageInfo.total = res?.total || 0
}
const getListPage = async () => {
const res: any = await fetchmoduleStatExternalPage({
waibuKd: waibuKd.value,
visitDay: visitDay.value,
moduleCode: moduleCode.value,
pageNum: pageInfo.currentPage,
pageSize: pageInfo.pageSize
})
outDetail.value = res?.rows || []
pageInfo.total = res?.total || 0
}
getListPage()
// getInsideListPage()
const clickButton = (id) => {
primary.value = id
@ -53,29 +90,33 @@ const state = reactive<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)
})
chartOption1.value = Chart1(xAxisData,siomesData)
dataList.value = data
let xAxisData: any[] = []
let siomesData: any[] = []
data.forEach((item: { moduleName: any; visitCount: any }) => {
xAxisData.push(item.moduleName)
siomesData.push(item.visitCount)
})
chartOption1.value = Chart1(xAxisData, siomesData)
}
const externalList = ref<any>([])
const externalObj = ref<any>({})
const getExternalTimeStat = async () => {
const { data } = await externalTimeStat(state)
externalList.value = data
let xAxisData:any[]=[]
let siomesData:any[]=[]
data.forEach((item: { moduleName: any; visitCount: any; })=>{
xAxisData.push(item.moduleName)
siomesData.push(item.visitCount)
})
chartOption2.value = Chart1(xAxisData,siomesData)
// chartOption2.value.height=3000
// chartOption2.value.width=1000
let xAxisData: any[] = []
let siomesData: any[] = []
data.forEach(
(item: { moduleName: any; visitCount: any; moduleCode: any }) => {
externalObj.value[item.moduleCode] = item.moduleName
xAxisData.push(item.moduleName)
siomesData.push(item.visitCount)
}
)
chartOption2.value = Chart1(xAxisData, siomesData)
// chartOption2.value.height=3000
// chartOption2.value.width=1000
}
const ss = computed(() => [state.startTime, state.endTime, state.timeType])
watch(
@ -83,7 +124,7 @@ watch(
async (v) => {
console.log(state.type)
getDat()
getExternalTimeStat()
getExternalTimeStat()
},
{ immediate: true, deep: true }
)
@ -91,7 +132,6 @@ watch(
onMounted(() => {
// getDat()
// console.log(formatDate(value1.value[0]).substring(0, 10))
})
const shortcuts = [
{
@ -166,40 +206,80 @@ const shortcuts = [
}
]
const handleClick = ({paneName}:any) => {
paneName === 'out' && getExternalTimeStat()
paneName === 'inside' && getDat()
const handleClick = ({ paneName }: any) => {
pageInfo.currentPage = 1
pageInfo.pageSize = 10
pageInfo.total = 0
paneName === 'out' && getExternalTimeStat()
paneName === 'inside' && getDat()
paneName === 'out-detail' && getListPage()
paneName === 'inside-detail' && getInsideListPage()
}
const selValue =ref('')
const selValue = ref('')
</script>
<template>
<HomeHead class="top"></HomeHead>
<div class="w-full h-834px mt30px rd-20px bg-#fff p30px overflow-hidden">
<div class="min-h-30px ">
<span class="text-#000">日期: </span>
<el-config-provider :locale="zhCn">
<div class="w-full h-850px mt30px rd-20px bg-#fff p30px overflow-hidden">
<div class="min-h-30px flex items-center">
<span class="text-#000 mr-10px">日期: </span>
<div class="max-w-350px flex items-center">
<el-date-picker
v-if="['inside', 'out'].includes(activeName)"
v-model="value1"
type="daterange"
range-separator="到"
start-placeholder="开始时间"
end-placeholder="结束时间"
size="small"
@change="timenFirst"
:shortcuts="shortcuts"
/>
</el-config-provider>
<el-date-picker
v-else
v-model="visitDay"
type="date"
value-format="YYYY-MM-DD"
placeholder="选择日期"
/>
</div>
<div class="mx-4 flex items-center">
<span class="text-#000 mr-10px">模块: </span>
<el-select
v-if="'out-detail' === activeName"
v-model="moduleCode"
placeholder="选择模块"
>
<el-option
v-for="item in externalList"
:key="item.id"
:label="item.moduleName"
:value="item.moduleCode"
/>
</el-select>
</div>
<div class="flex items-center">
<span class="text-#000 mr-10px w-50px">供方: </span>
<el-input
v-model="waibuKd"
placeholder="请输入供方昵称或代码"
></el-input>
</div>
<el-button
type="primary"
:icon="Search"
size="small"
class="ml20px mt--5px"
>搜素</el-button
@click="handleClick({ paneName: activeName })"
>搜索</el-button
>
<template v-if="activeName !== 'inside' && false">
<el-select v-model="selValue" class="ml-20px mt-[-4px]" placeholder="Select" size="small">
<el-select
v-model="selValue"
class="ml-20px mt-[-4px]"
placeholder="Select"
size="small"
>
<el-option
v-for="item in externalList"
:key="item.moduleCode"
@ -215,23 +295,23 @@ const selValue =ref('')
<el-button :type="primary == 3 ? 'primary' : ''" :icon="Search" class="!ml30px mt--5px"
@click="clickButton(3)">本月</el-button> -->
</div>
<el-tabs class="mt-20px" v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="本部足迹" name="inside">
<div class="mt20px w-full">
<span
class="cardfoot text-#000 p30px mx10px my10px text-center text-18px font-bold"
v-if="dataList"
v-for="i in dataList"
>
<span>{{ i.moduleName }}</span
><br />
<br />
<span class="mt10px">{{ i.visitCount }}</span>
</span>
</div>
<el-tabs class="mt-20px" v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="本部足迹" name="inside">
<div class="mt20px w-full">
<span
class="cardfoot text-#000 p30px mx10px my10px text-center text-18px font-bold"
v-if="dataList"
v-for="i in dataList"
>
<span>{{ i.moduleName }}</span
><br />
<br />
<span class="mt10px">{{ i.visitCount }}</span>
</span>
</div>
<div class="mt10px w-full">
<!-- <div class="relative w-full h-50px flex">
<div class="mt10px w-full">
<!-- <div class="relative w-full h-50px flex">
<el-button :type="primarys == 2 ? 'primary' : ''" :icon="Search" class="!ml30px mt--5px"
@click="clickButtons(2)">本周</el-button>
<el-button :type="primarys == 3 ? 'primary' : ''" :icon="Search" class="!ml30px mt--5px"
@ -243,46 +323,153 @@ const selValue =ref('')
</el-config-provider>
</div>
</div> -->
<div class="w-full h-400px">
<VChart key="yyy" ref="chartRef1" :option="chartOption1" />
</div>
</div>
</el-tab-pane>
<el-tab-pane label="外部足迹" name="out">
</el-tab-pane>
</el-tabs>
<div >
<div class="mt20px w-full">
<span
class="cardfoot text-#000 p30px mx10px my10px text-center text-18px font-bold"
v-if="dataList"
v-for="i in externalList"
>
<span>{{ i.moduleName }}</span
><br />
<br />
<span class="mt10px">{{ i.visitCount }}</span>
</span>
</div>
<div class="w-full h-400px">
<VChart key="yyy" ref="chartRef1" :option="chartOption1" />
</div>
</div>
</el-tab-pane>
<el-tab-pane v-if="false" label="本部足迹-明细" name="inside-detail">
<div v-if="activeName === 'inside-detail'" class="h-720px">
<div class="w100% h-full overflow-auto">
<el-table
:data="inseideDetail"
style="width: 100%; margin-bottom: 20px"
row-key="id"
border
default-expand-all
:header-cell-style="{
background: '#2A7BF7',
color: '#fff',
height: '60px',
lineHeight: '60px',
textAlign: 'center',
'font-size': '24px'
}"
:cell-style="{ 'text-align': 'center', 'overflow-y': 'auto' }"
>
<el-table-column prop="deptName" label="排序" />
<el-table-column
prop="cateName"
label="所属分类"
show-overflow-tooltip
>
<template #default="scope">
<span v-if="scope"></span>
</template>
</el-table-column>
<el-table-column
prop="title"
label="标题名称"
show-overflow-tooltip
/>
<el-table-column
label="文件列表"
prop="filePath"
show-overflow-tooltip
/>
<el-table-column label="排序" prop="sort" show-overflow-tooltip />
<el-table-column label="查看范围" prop="userIdList">
<template #default="scope">
<el-button type="primary" class="button" @click=""
>查看范围</el-button
>
</template>
</el-table-column>
</el-table>
</div>
<div class="absolute bottom-2px right-30px z-20 bg-#fff">
<el-pagination
v-model:current-page="pageInfo.currentPage"
v-model:page-size="pageInfo.pageSize"
layout="prev, pager, next, jumper"
:total="pageInfo.total"
@size-change="getInsideListPage"
@current-change="getInsideListPage"
/>
</div>
</div>
</el-tab-pane>
<el-tab-pane label="外部足迹" name="out"> </el-tab-pane>
<el-tab-pane label="外部足迹-明细" name="out-detail">
<div class="h-720px">
<div class="w100% h-full overflow-auto">
<el-table
:data="outDetail"
style="width: 100%; margin-bottom: 20px"
row-key="id"
border
default-expand-all
:header-cell-style="{
background: '#2A7BF7',
color: '#fff',
height: '60px',
lineHeight: '60px',
textAlign: 'center',
'font-size': '24px'
}"
:cell-style="{ 'text-align': 'center', 'overflow-y': 'auto' }"
>
<el-table-column prop="userId" label="供方ID" />
<el-table-column
prop="nickName"
label="供方昵称"
show-overflow-tooltip
>
</el-table-column>
<el-table-column
prop="title"
label="访问模块"
show-overflow-tooltip
>
<template #default="{ row }">
<span>{{ externalObj[row.moduleCode] || '' }}</span>
</template>
</el-table-column>
<el-table-column
label="访问计数"
prop="visitCount"
show-overflow-tooltip
/>
<el-table-column
label="访问时间"
prop="visitDay"
show-overflow-tooltip
/>
</el-table>
</div>
<div class="absolute bottom-2px right-30px z-20 bg-#fff">
<el-pagination
v-model:current-page="pageInfo.currentPage"
v-model:page-size="pageInfo.pageSize"
layout="prev, pager, next, jumper"
:total="pageInfo.total"
@size-change="getListPage"
@current-change="getListPage"
/>
</div>
</div>
</el-tab-pane>
</el-tabs>
<div>
<div class="mt20px w-full">
<span
class="cardfoot text-#000 p30px mx10px my10px text-center text-18px font-bold"
v-if="externalList"
v-for="i in externalList"
>
<span>{{ i.moduleName }}</span
><br />
<br />
<span class="mt10px">{{ i.visitCount }}</span>
</span>
</div>
<div class="mt10px w-full">
<!-- <div class="relative w-full h-50px flex">
<el-button :type="primarys == 2 ? 'primary' : ''" :icon="Search" class="!ml30px mt--5px"
@click="clickButtons(2)">本周</el-button>
<el-button :type="primarys == 3 ? 'primary' : ''" :icon="Search" class="!ml30px mt--5px"
@click="clickButtons(3)">本月</el-button>
<div class="absolute right-60px w300px ">
<el-config-provider :locale="zhCn">
<el-date-picker v-model="value2" type="daterange" range-separator="-" start-placeholder=""
end-placeholder="结束时间" size="small" @change="timenFirsts" />
</el-config-provider>
</div>
</div> -->
<div class="w-full h-400px">
<VChart key="xxxx" ref="chartRef2" :option="chartOption2" />
</div>
</div>
</div>
<div class="mt10px w-full">
<div class="w-full h-400px">
<VChart key="xxxx" ref="chartRef2" :option="chartOption2" />
</div>
</div>
</div>
</div>
</template>
@ -308,9 +495,9 @@ const selValue =ref('')
right: 30px;
top: -92px;
}
::v-deep{
.el-tabs__item{
font-size: 16px !important;
}
::v-deep {
.el-tabs__item {
font-size: 16px !important;
}
}
</style>

View File

@ -1,6 +1,6 @@
<!-- 外部情报 -->
<script setup lang="ts">
import Vue3Tinymce from '@jsdawn/vue3-tinymce';
// import Vue3Tinymce from '@jsdawn/vue3-tinymce';
import HomeHead from "@/views/home/components/HomeHead.vue";
// import HomeHeadSearch from '@/views/home/components/HomeHeadSearch.vue'
import { useDate } from "@/views/home/hooks/useDate";
@ -15,7 +15,7 @@ import {
NSpace,
NRadioGroup,
useMessage,
FormInst,
// FormInst,
} from "naive-ui";
import { saveArticle, trendsDetail } from "@/api/daikin/base";
import Editor from "../components/TinyECE.vue";
@ -28,7 +28,7 @@ let route = useRoute();
let cate = ref(1);
const fileList = ref<[]>();
const editorContent = ref("");
const formRef = ref<FormInst | null>(null);
const formRef = ref<any | null>(null);
const message = useMessage();
const formValue: any = ref({

View File

@ -1,6 +1,6 @@
<!-- 市况 -->
<script setup lang="ts">
import { Chart1, Chart2, Chart3, Chart4, Chart5, Chart6 } from './MarketData'
import { Chart1, Chart3, Chart4, Chart5, Chart6 } from './MarketData'
import HomeHead from '@/views/home/components/HomeHead.vue'
import AppBlock from '@/components/AppBlock.vue'
import AppNewsBox from '@/components/AppNewsBox.vue'

View File

@ -1,62 +1,71 @@
import { fileURLToPath, URL } from "node:url";
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import vueJsx from "@vitejs/plugin-vue-jsx";
import Unocss from "unocss/vite";
import { presetUno } from "unocss";
import AutoImport from "unplugin-auto-import/vite";
import Components from 'unplugin-vue-components/vite';
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers';
import ViteCompression from 'vite-plugin-compression';
import PurgeIcons from 'vite-plugin-purge-icons';
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import Unocss from 'unocss/vite'
import { presetUno } from 'unocss'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import ViteCompression from 'vite-plugin-compression'
import PurgeIcons from 'vite-plugin-purge-icons'
// https://vitejs.dev/config/
export default defineConfig({
server: {
proxy: {
'/test-api':
{
target:"http://admin.echo.mteam01.com/openApi/",
changeOrigin: true,
rewrite: (path) => path.replace(/^\/test-api/, '') // 设置重写的路径
},}
server: {
proxy: {
'/test-api': {
target: 'http://admin.echo.mteam01.com/openApi/',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/test-api/, '') // 设置重写的路径
}
}
},
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
},
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
},
},
plugins: [
vue(),
vueJsx(),
Unocss({
presets: [presetUno()],
}),
AutoImport({
imports: ["vue", "vue-router", "@vueuse/core"], // 自动导入vue和vue-router相关函数
dts: "src/types/auto-import.d.ts",
// eslint报错解决 https://blog.csdn.net/sayUonly/article/details/123482912
eslintrc: {
enabled: false, // Default `false`
filepath: "./.eslintrc-auto-import.json", // Default `./.eslintrc-auto-import.json`
globalsPropValue: true, // Default `true`, (true | false | 'readonly' | 'readable' | 'writable' | 'writeable')
},
resolvers: [
ElementPlusResolver(),
],
}),
Components({
resolvers: [ ElementPlusResolver(),
],
}),
PurgeIcons(),
ViteCompression({
algorithm: 'gzip', // 选择压缩算法,支持 'gzip' 或 'brotli'
ext: '.gz', // 压缩后文件的扩展名
}),
],
});
plugins: [
vue(),
vueJsx(),
Unocss({
presets: [presetUno()]
}),
AutoImport({
imports: ['vue', 'vue-router', '@vueuse/core'], // 自动导入vue和vue-router相关函数
dts: 'src/types/auto-import.d.ts',
// eslint报错解决 https://blog.csdn.net/sayUonly/article/details/123482912
eslintrc: {
enabled: false, // Default `false`
filepath: './.eslintrc-auto-import.json', // Default `./.eslintrc-auto-import.json`
globalsPropValue: true // Default `true`, (true | false | 'readonly' | 'readable' | 'writable' | 'writeable')
},
resolvers: [ElementPlusResolver()]
}),
Components({
resolvers: [ElementPlusResolver()]
}),
PurgeIcons(),
ViteCompression({
algorithm: 'gzip', // 选择压缩算法,支持 'gzip' 或 'brotli'
ext: '.gz', // 压缩后文件的扩展名
verbose: false
})
],
build: {
chunkSizeWarningLimit: 4000,
sourcemap: false, // Builds sourcemaps for better debugging but could be disabled for performance
minify: 'esbuild', // Use 'terser' for minimizing your codes, it could be 'esbuild' but 'terser' is more accurate
rollupOptions: {
treeshake: true // Enable tree-shaking
},
terserOptions: {
compress: {
// pure_funcs: ['console.log', 'console.info'] // Remove console.log and console.info from production build
}
}
}
})