新加公告通知页面

test
zhangdi 1 year ago
parent f1e9b656aa
commit 5256936d8a
  1. 7
      pages.json
  2. 4
      pages/home/components/eacharts.vue
  3. 307
      pages/home/components/eacharts_pie.vue
  4. 50
      pages/home/index.vue
  5. 180
      pages/notice/announcement.vue

@ -16,6 +16,13 @@
"navigationBarTitleText": "消息中心",
"enablePullDownRefresh": false
}
},
{
"path": "pages/notice/announcement",
"style": {
"navigationBarTitleText": "公告中心",
"enablePullDownRefresh": false
}
}
],
"subPackages": [

@ -1,12 +1,12 @@
<template>
<view class="eacharts-box">
<view class="eacharts-time">
<u-form :model="form" ref="uForm">
<!-- <u-form :model="form" ref="uForm">
<u-form-item label="选择时间:" label-width="140" :border-bottom="false">
<u-input v-model="form.searchTime" type="select" @click="calendarShow = true" :border="true"
placeholder="请选择时间" />
</u-form-item>
</u-form>
</u-form> -->
<u-calendar v-model="calendarShow" :mode="mode" @change="change"></u-calendar>
</view>
<!-- eacharts 图表 -->

@ -0,0 +1,307 @@
<template>
<view class="eacharts-box">
<!-- 饼状图 -->
<view class="echartsPie">
<view class="pie-item">
<view style="height:308rpx"><l-echart ref="chartRefPieLeft" :key="Math.random()"></l-echart></view>
</view>
</view>
</view>
</template>
<script>
import * as echarts from "echarts";
import lEchart from "@/uni_modules/lime-echart/components/lime-echart/";
export default {
components: { lEchart },
props: {
type: {
type: String,
default: "",
},
data:{
type:Array,
default:[]
}
},
data() {
return {
form: {
searchTime: "",
startTime: "",
endTime: "",
},
calendarShow: false,
mode: "range",
upkeepStatInfo: {},
pieInfo: {},//
};
},
mounted() {
this.maintenancePieLeftInit()
// //
// if (this.type == "maintenanceStatistics") {
// this.upkeepStat()
// }
// if (this.type == "maintenanceStatisticsPie") {
// this.pieStat()
// }
},
methods: {
//
upkeepStat() {
let query_ = {
startTime: this.form.startTime,
endTime: this.form.endTime,
}
// if(this.form.startTime!=''){
// query_.startTime=this.form.startTime
// }
// if(this.form.endTime!=''){
// query_.endTime=this.form.endTime
// }
this.$u.api.upkeepStat(query_).then(res => {
if (res.code == 200) {
this.upkeepStatInfo = JSON.parse(JSON.stringify(res.data))
this.maintenanceInit();
}
})
},
//
pieStat() {
let query_ = {
startTime: this.form.startTime,
endTime: this.form.endTime,
}
this.$u.api.pieStat(query_).then(res => {
if (res.code == 200) {
this.pieInfo = res.data
this.maintenancePieLeftInit();
this.maintenancePieRightInit();
}
})
},
selectFun() {
this.calendarShow = true;
},
change(e) {
this.form.startTime = e.startDate;
this.form.endTime = e.endDate;
this.form.searchTime = e.startDate + "-" + e.endDate;
if (this.type == "maintenanceStatistics") {
this.upkeepStat()
}
if (this.type == "maintenanceStatisticsPie") {
this.pieStat()
}
//
},
//
maintenanceInit() {
let opts = {
tooltip: {},
legend: {
//
data: ["总计", "已完成", "未完成"],
},
xAxis: {
data: this.upkeepStatInfo.xData,
},
grid: {
top: "15%",
left: "10%",
right: "5%",
bottom: "15%",
},
yAxis: {},
series: [
{
name: "总计",
type: "bar",
data: this.upkeepStatInfo.total,
barWidth: 30, //
barGap: "0", // 0
itemStyle: {
color: "#2478f2",
},
},
{
name: "已完成",
type: "bar",
data: this.upkeepStatInfo.completed,
barWidth: 30, //
barGap: "0", // 0
itemStyle: {
color: "#84b7f9",
},
},
{
name: "未完成",
type: "bar",
data: this.upkeepStatInfo.unCompleted,
barWidth: 30, //
barGap: "0", // 0
itemStyle: {
color: "#5f9cf8",
},
},
],
};
this.$refs.chartRef.init((config) => {
const { canvas } = config;
const chart = echarts.init(canvas, null, config);
chart.setOption(opts);
// chart
return chart;
});
},
//
maintenancePieLeftInit() {
let opts = {
series: [
{
name: "",
type: "pie",
radius: ['40%', '70%'],
label: {
// .
normal: {
show: true,
fontSize: 8, // [ default: false ]
position: "outside", // 'outside'线'inside','inner' 'inside','center'
formatter: "{b}\n {c}", //
color: '#000'
},
},
data: this.data,
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: "rgba(0, 0, 0, 1)",
},
},
labelLine: {
// 线, label 'outside'线
normal: {
show: true, // 线
length: 5, // label 'outside'线
length2: 5,
//
lineStyle: {
// 线
type: "solid",
},
},
},
},
],
};
this.$refs.chartRefPieLeft.init((config) => {
const { canvas } = config;
const chart = echarts.init(canvas, null, config);
chart.setOption(opts);
// chart
return chart;
});
},
maintenancePieRightInit() {
let opts = {
series: [
{
type: "pie",
radius: ['40%', '70%'],
label: {
// .
normal: {
show: true,
fontSize: 8, // [ default: false ]
position: "outside", // 'outside'线'inside','inner' 'inside','center'
formatter: "{b}\n {c}", //
color: '#000'
},
},
data: this.pieInfo.device,
labelLine: {
// 线, label 'outside'线
normal: {
show: true, // 线
length: 5, // label 'outside'线
length2: 5,
//
lineStyle: {
// 线
type: "solid",
},
},
},
},
],
};
this.$refs.chartRefPieRight.init((config) => {
const { canvas } = config;
const chart = echarts.init(canvas, null, config);
chart.setOption(opts);
// chart
return chart;
});
},
},
};
</script>
<style lang="scss" scoped>
.eacharts-box {
background: #fff;
margin: 0 40rpx 32rpx;
border-radius: 20rpx;
overflow: hidden;
.eacharts-time {
margin: 0 136rpx 0 24rpx;
display: flex;
flex-direction: row;
text {
line-height: 60rpx;
color: rgba(16, 16, 16, 1);
font-size: 28rpx;
margin-top: 30rpx;
margin-right: 10rpx;
}
}
.echarts {
width: calc(100% - 64rpx);
height: 308rpx;
margin: 0 auto 20rpx;
}
.echartsPie {
width: calc(100% - 64rpx);
min-height: 308rpx;
margin: 0 auto 0;
.pie-item {
width: 100%;
height: 368rpx;
// float: left;
}
}
.pie-title {
height: 30rpx;
text-align: center;
display: block;
color: rgba(16, 16, 16, 1);
font-size: 28rpx;
}
}
</style>

@ -7,6 +7,11 @@
</u-icon>
</view>
</u-navbar>
<!-- 通知公告 -->
<view class="notice_box" v-if="noticeList.length>0">
<u-notice-bar mode="horizontal" type="primary" :list="noticeList" :more-icon="true"
@getMore="getNotice()"></u-notice-bar>
</view>
<view class="">
<view class="banner-swiper" v-if="swiperList.length > 0">
<image :src="swiperList[0]" style="padding-right:12rpx;height:444rpx;width:100%"></image>
@ -28,14 +33,17 @@
</view>
</view>
</view>
<view class="work-title">通知公告</view>
<view class="work-title">实验室巡检</view>
<swiperSlider></swiperSlider>
<view class="work-title">设备统计</view>
<eacharts_pie :data="pieInfo"></eacharts_pie>
<view class="work-title">检修单状态</view>
<!-- <view>
<alarm></alarm>
</view> -->
<view class="work-title">维修统计</view>
<view class="statistics">
<eacharts :type="'maintenanceStatistics'"></eacharts>
@ -50,21 +58,31 @@
import swiperSlider from "./components/swiper.vue";
import alarm from "./components/alarm.vue";
import eacharts from "./components/eacharts.vue";
import eacharts_pie from "./components/eacharts_pie.vue";
export default {
components: {
swiperSlider,
alarm,
eacharts,
eacharts_pie
},
data() {
return {
swiperList: [],
workList: [],
pieInfo: [],//
noticeList: [
'寒雨连江夜入吴',
'平明送客楚山孤',
'洛阳亲友如相问',
'一片冰心在玉壶'
],//
};
},
onShow() {
this.$nextTick(() => {
this.$refs.tabbarRef.getPermission();
// this.BetLoading.show();
// setTimeout(() => {
// this.BetLoading.hide();
@ -120,14 +138,9 @@ export default {
})
},
goPage(item) {
// if (item.pagePath == '') {
// uni.showToast({ title: "", icon: "none" });
// } else {
uni.navigateTo({
url: item,
});
// }
},
scanCode() {
uni.scanCode({
@ -140,6 +153,20 @@ export default {
console.error('扫码失败:' + err);
}
});
},
//
pieStat() {
this.$u.api.pieStat().then(res => {
if (res.code == 200) {
this.pieInfo = res.data.fault
}
})
},
//
getNotice() {
uni.navigateTo({
url: '/pages/notice/announcement',
});
}
},
};
@ -152,7 +179,7 @@ export default {
padding-top: var(--status-bar-height);
.banner-swiper {
margin-bottom: 64rpx;
margin-bottom: 32rpx;
position: relative;
.logo-txt {
@ -316,5 +343,10 @@ export default {
}
}
}
.notice_box {
width: 100%;
background: #fff;
}
}
</style>

@ -0,0 +1,180 @@
<template>
<view class="notice-list">
<scroll-view scroll-y="true" style="height:calc(100vh - 140rpx);width: 100%;background: #F5F5F5;margin-top:32rpx"
:refresher-triggered="triggered" :refresher-enabled="true" @refresherrefresh="refresherrefresh"
refresher-background="#f1f1f1" @scrolltolower="onListBottom">
<ul class="card">
<li v-for="(item, index) in dataList" :key="index" @click="jump(item)">
<view class="title">
<view class="text">
<view>{{ item.title }}</view>
<view class="mark" v-if="!item.readStatus"></view>
</view>
<view style="flex-shrink: 0;color: #999999;">{{ item.createdAt }}</view>
</view>
<view>
<!-- {{ item.content }} -->
<u-parse :html="item.content"></u-parse>
</view>
</li>
</ul>
<view style=" line-height: 100rpx;">
<uni-load-more :status="scrollType"></uni-load-more>
</view>
</scroll-view>
</view>
</template>
<script>
// import requestName from '@/common/requestName'
export default {
name: 'NoticeList',
data() {
return {
dataList: [
{
title:'11111',//
createdAt:'转发通知',
content:'222<p>44444444444</p>',
readStatus:true
}
],
current: 0,
style: {
borderRadius: '100px',
background: '#fff',
padding: '0 32rpx'
},
search: {
pageNo: 1,
pageSize: 20,
readStatus: ''
},
scrollType: '',
triggered: false,
refreshNeed: false
}
},
onLoad(data) {
this.getList()
},
onShow() {
console.log(this.refreshNeed);
if (this.refreshNeed) {
this.reSearch()
}
},
methods: {
getList() {
// this.$wx_http.get(requestName['pageNotice'], this.search).then(res => {
// let data = res.data.records
// this.scrollType = ''
// this.triggered = false
// if (data.length >= this.search.pageSize) {
// this.scrollType = 'more'
// }
// this.dataList = this.dataList.concat(data)
// })
},
reSearch() {
this.search.pageNo = 1
this.dataList = []
this.getList()
},
onListBottom() {
if (this.scrollType == 'more') {
this.search.pageNo += 1
this.getList()
}
},
onreachBottom() {
this.getDevicePage()
},
refresherrefresh() {
this.triggered = true
this.reSearch()
}
},
}
</script>
<style lang="scss" scoped>
.notice-list {
height: calc(100vh - 0px);
background: #F5F5F5;
overflow: hidden;
.mark-read-btn {
background: #FFFFFF;
border-radius: 8rpx;
border: 1px solid rgba(255, 255, 255, 0.43);
padding: 0;
margin: 24rpx 30rpx;
text-align: center;
height: 88rpx;
line-height: 88rpx;
font-size: 30rpx;
color: #FF8800;
display: flex;
justify-content: center;
align-items: center;
image {
width: 34rpx;
height: 32rpx;
display: block;
margin-right: 20rpx;
fill:#004BAA
}
}
.card {
margin: 0 16px;
list-style: none;
padding: 0;
li {
background: #FFFFFF;
border-radius: 4px;
border: 1px solid rgba(255, 255, 255, 0.43);
padding: 12px 14px;
margin-bottom: 24rpx;
font-size: 28rpx;
.title {
border-bottom: 1px solid #F0F0F0;
display: flex;
justify-content: space-between;
padding-bottom: 10rpx;
margin-bottom: 15rpx;
.text {
font-size: 30rpx;
flex-grow: 1;
display: flex;
margin-right: 20rpx;
font-weight: 400;
color: #333333;
}
.mark {
width: 16rpx;
height: 16rpx;
background: #D9362D;
border-radius: 50%;
margin-left: 12rpx;
margin-top: 5rpx;
flex-shrink: 0;
}
}
}
}
}
</style>
Loading…
Cancel
Save