diff --git a/weapp/package/subSystem/subSystem.js b/weapp/package/subSystem/subSystem.js
index c90bfdf..d791c92 100644
--- a/weapp/package/subSystem/subSystem.js
+++ b/weapp/package/subSystem/subSystem.js
@@ -1,124 +1,98 @@
// package/subSystem/subSystem.js
-import * as echarts from 'echarts' // 从 npm 引入 echarts
+import * as echarts from '../components/ec-canvas/echarts';
let chart = null;
function initChart(canvas, width, height, dpr) {
- chart = echarts.init(canvas, null, {
- width: width,
- height: height,
- devicePixelRatio: dpr // new
- });
- canvas.setChart(chart);
-
- var option = {
- tooltip: {
- trigger: 'axis',
- axisPointer: { // 坐标轴指示器,坐标轴触发有效
- type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
- },
- confine: true
- },
- legend: {
- data: ['热度', '正面', '负面']
- },
- grid: {
- left: 20,
- right: 20,
- bottom: 15,
- top: 40,
- containLabel: true
- },
- xAxis: [
- {
- type: 'value',
- axisLine: {
- lineStyle: {
- color: '#999'
- }
- },
- axisLabel: {
- color: '#666'
- }
- }
- ],
- yAxis: [
- {
- type: 'category',
- axisTick: { show: false },
- data: ['汽车之家', '今日头条', '百度贴吧', '一点资讯', '微信', '微博', '知乎'],
- axisLine: {
- lineStyle: {
- color: '#999'
- }
- },
- axisLabel: {
- color: '#666'
- }
- }
- ],
- series: [
- {
- name: '热度',
- type: 'bar',
- label: {
- normal: {
- show: true,
- position: 'inside'
- }
- },
- data: [300, 270, 340, 344, 300, 320, 310],
- itemStyle: {
- // emphasis: {
- // color: '#37a2da'
- // }
- }
- },
- {
- name: '正面',
- type: 'bar',
- stack: '总量',
- label: {
- normal: {
- show: true
- }
- },
- data: [120, 102, 141, 174, 190, 250, 220],
- itemStyle: {
- // emphasis: {
- // color: '#32c5e9'
- // }
- }
- },
- {
- name: '负面',
- type: 'bar',
- stack: '总量',
+ const chart = echarts.init(canvas, null, {
+ width: 300,
+ height: 300,
+ devicePixelRatio: dpr // new
+ });
+ canvas.setChart(chart);
+
+ var option = {
+ backgroundColor: "#ffffff",
+ series: [{
label: {
normal: {
- show: true,
- position: 'left'
+ fontSize: 14
}
},
- data: [-20, -32, -21, -34, -90, -130, -110],
- itemStyle: {
- // emphasis: {
- // color: '#67e0e3'
- // }
- }
- }
- ]
- };
-
- chart.setOption(option);
- return chart;
-}
+ type: 'pie',
+ center: ['50%', '50%'],
+ radius: ['20%', '40%'],
+ data: [{
+ value: 55,
+ name: '北京'
+ }, {
+ value: 20,
+ name: '武汉'
+ }, {
+ value: 10,
+ name: '杭州'
+ }, {
+ value: 20,
+ name: '广州'
+ }, {
+ value: 38,
+ name: '上海'
+ }]
+ }]
+ };
+
+ chart.setOption(option);
+ return chart;
+ }
Page({
/**
* 页面的初始数据
*/
data: {
+ ec: {
+ onInit: initChart
+ },
+ date: '',
+ show: true,
+ selectedDate: new Date(),// 设置默认选中的日期为当前日期
+ formatter(day) {
+ console.log('xxasaasas',day)
+ const month = day.date.getMonth() + 1;
+ const date = day.date.getDate();
+ const style = {};
+ if (month === 10) {
+ if (date === 1) {
+ day.bottomInfo = '.';
+ day.className='dayClass'
+ style.backgroundColor = 'red';
+ // document.getElementsByClassName('van-calendar__bottom-info')
+ }
+ }
+
+ if (day.type === 'start') {
+ day.bottomInfo = '入住';
+ } else if (day.type === 'end') {
+ day.bottomInfo = '离店';
+ }
+ day.style = style;
+ console.log('day111',day)
+ return day;
+ },
+
+ },
+
+ onDisplay() {
+ this.setData({ show: true });
+ },
+ onClose() {
+ this.setData({ show: false });
+ },
+ onConfirm(event) {
+ this.setData({
+ show: false,
+ date: this.formatDate(event.detail),
+ });
},
/**
@@ -129,6 +103,23 @@ Page({
title: options.key,
});
// 其他渲染逻辑
+ // 创建一个 Date 对象来获取当前日期
+ const currentDate = new Date();
+ // 获取当前年份
+ const currentYear = currentDate.getFullYear();
+ // 获取当前月份(注意,月份是从 0 到 11 表示,所以需要加 1)
+ const currentMonth = currentDate.getMonth() + 1;
+ // 获取当前月份的第一天和最后一天
+ const nextMonth = new Date().getMonth() + 1;
+ const firstDay = new Date().setDate(1);
+ const lastDay = new Date().setMonth(nextMonth,1) - 86400000;
+ // 更新数据,将年份和月份传递给 WXML 页面
+ this.setData({
+ currentYear: currentYear,
+ currentMonth: currentMonth,
+ lastDay:lastDay,
+ firstDay:firstDay
+ });
},
/**
diff --git a/weapp/package/subSystem/subSystem.json b/weapp/package/subSystem/subSystem.json
index 2729180..14a8b42 100644
--- a/weapp/package/subSystem/subSystem.json
+++ b/weapp/package/subSystem/subSystem.json
@@ -1,5 +1,8 @@
{
- "usingComponents": {
+ "usingComponents": {
+ "ec-canvas": "../components/ec-canvas/ec-canvas",
+ "van-calendar": "@vant/weapp/calendar/index"
+
}
}
\ No newline at end of file
diff --git a/weapp/package/subSystem/subSystem.wxml b/weapp/package/subSystem/subSystem.wxml
index 4018653..d8908dc 100644
--- a/weapp/package/subSystem/subSystem.wxml
+++ b/weapp/package/subSystem/subSystem.wxml
@@ -1,15 +1,34 @@
-
-
-
- 本月巡检次数
- 0
-
-
- 本月维修次数
- 0
+
+
+
+ 本月巡检次数
+ 0
+
+
+ 本月维修次数
+ 0
+
+
+
+
+
-
-
+
+
+
\ No newline at end of file
diff --git a/weapp/package/subSystem/subSystem.wxss b/weapp/package/subSystem/subSystem.wxss
index e15f058..47daae2 100644
--- a/weapp/package/subSystem/subSystem.wxss
+++ b/weapp/package/subSystem/subSystem.wxss
@@ -17,7 +17,44 @@
background-color: #fff;
border: 1px solid #ddd;
border-radius: 8px;
- padding: 10px 0px;
+ /* padding: 10px 10px; */
margin: 5px 5px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
- }
\ No newline at end of file
+ width: 300px;
+ height: 300px;
+ }
+ .xunjian{
+ width: 64px;
+ height: 22px;
+ font-family: PingFangSC-Medium;
+ font-weight: 500;
+ font-size: 16px;
+ color: #000000d9;
+ letter-spacing: 0;
+ }
+ .yearMonth{
+ width: 85px;
+ height: 20px;
+ font-family: PingFangSC-Medium;
+ font-weight: 500;
+ font-size: 14px;
+ color: #1684FF;
+ letter-spacing: 0;
+ text-align: right;
+ }
+ .header{
+ display: flex;
+ justify-content: space-around;
+ margin-bottom: 10px;
+ margin-top:10px;
+ }
+ .dayClass .van-calendar__bottom-info{
+ font-size: large;
+ color:blue;
+ }
+
+
+
+
+
+
diff --git a/weapp/pages/home/home.js b/weapp/pages/home/home.js
index 7613c43..178bea2 100644
--- a/weapp/pages/home/home.js
+++ b/weapp/pages/home/home.js
@@ -1,7 +1,10 @@
// pages/home/home.js
+import { getPatrolRecord } from "../../utils/getApiUrl";
+import { Request } from "../../common";
+const moment = require("../../utils/moment");
+
Page({
jumpToSubSystem (options) {
- console.log('1sadsdasd',options)
const key = options.currentTarget.dataset.key;
wx.navigateTo({
url: `/package/subSystem/subSystem?key=${key}`,
@@ -11,6 +14,15 @@ Page({
* 页面的初始数据
*/
data: {
+ sevenDaysCount:0,//过去七天的巡检次数
+ sevenDaysQuestionCount:0,//过去七天发现问题个数
+ sevenDaysHandleCount:0,//过去七天问题解决个数
+ allCount:0,//总的巡检次数
+ allQuestionCount:0,//总的发现问题个数
+ allHandleCount:0,//总的问题解决个数
+ todayRecord: [], // 今日巡检记录
+ markers: [],
+ isShowCallout: false,
itemList:[{
picPath:'/images/conduct.png',
itemName:'指挥中心'
@@ -60,13 +72,27 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad (options) {
+ const userInfo=wx.getStorageSync('userInfo');
const {windowHeight}=wx.getSystemInfoSync()
const pageHeight=windowHeight - 48
- this.setData({
- pageHeight:pageHeight+'px'
+ console.log('todayRecord1',this.todayRecord)
+ const promiseArr = [];
+ const that = this;
+ wx.showLoading({ title: '加载中' })
+ promiseArr.push(Request.get(getPatrolRecord('all', moment('1970-1-1').format('YYYY-MM-DD') + ' 00:00:00', moment('2099-12-31').format('YYYY-MM-DD') + ' 23:59:59', 'null', 'null')));
+ Promise.all(promiseArr).then(res => {
+ console.log('xxxaxax',userInfo)
+ console.log('xxxaxax',res[0]?.filter(item=>item?.points?.user.id===userInfo.id))
+ wx.hideLoading()
+ that.setData({
+ allCount:res[0]?.filter(item=>item?.points?.user.id===userInfo.id)?.length || 0,
+
+ todayRecord: res[0],
+ pageHeight:pageHeight+'px'
+ })
})
- console.log('xxxx',pageHeight)
},
+
/**
* 生命周期函数--监听页面初次渲染完成
diff --git a/weapp/pages/home/home.wxml b/weapp/pages/home/home.wxml
index 9a3fe85..d2574c0 100644
--- a/weapp/pages/home/home.wxml
+++ b/weapp/pages/home/home.wxml
@@ -26,7 +26,7 @@
发现问题个数
个
- 发现问题个数
+ 问题处理个数
个
@@ -39,14 +39,14 @@
巡检次数
- 次
+ {{allCount}}次
发现问题个数
个
- 发现问题个数
- 个
+ 问题处理个数
+ {{todayRecord.length}}个
\ No newline at end of file