2024-01-29 17:42:38 +08:00
|
|
|
import * as echarts from '../../ec-canvas/echarts';
|
|
|
|
|
import {
|
|
|
|
|
getMonthStartEnd,
|
|
|
|
|
formatTime
|
|
|
|
|
} from '../../utils/util'
|
|
|
|
|
let chart = null;
|
|
|
|
|
const app = getApp()
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取像素比
|
|
|
|
|
*/
|
|
|
|
|
const getPixelRatio = () => {
|
|
|
|
|
let pixelRatio = 0
|
|
|
|
|
wx.getSystemInfo({
|
|
|
|
|
success: function (res) {
|
|
|
|
|
pixelRatio = res.pixelRatio
|
|
|
|
|
},
|
|
|
|
|
fail: function () {
|
|
|
|
|
pixelRatio = 0
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
return pixelRatio
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 设置echarts
|
|
|
|
|
*/
|
|
|
|
|
function initChart(data) {
|
|
|
|
|
if (chart == null) return
|
|
|
|
|
chart.init((canvas, width, height) => {
|
|
|
|
|
var dpr = getPixelRatio();
|
|
|
|
|
const chart = echarts.init(canvas, null, {
|
|
|
|
|
width: width,
|
|
|
|
|
height: height,
|
|
|
|
|
devicePixelRatio: dpr
|
|
|
|
|
});
|
|
|
|
|
canvas.setChart(chart);
|
|
|
|
|
|
|
|
|
|
var colorList = ["#FF9C00", "#FF4E00", "#2678FF"]
|
|
|
|
|
var dataList = [data.resolving || 1, data.unresolved || 1, data.resolved || 1];
|
|
|
|
|
var totalNum = data.dangerTotal || -1;
|
|
|
|
|
var seriesList = []
|
|
|
|
|
dataList.forEach((item, index) => {
|
|
|
|
|
var obj = {
|
|
|
|
|
value: Math.floor(item / totalNum * 100),
|
|
|
|
|
}
|
|
|
|
|
seriesList.push({
|
|
|
|
|
type: 'bar',
|
|
|
|
|
data: [obj],
|
|
|
|
|
stack: 'one',
|
|
|
|
|
roundCap: true,
|
|
|
|
|
coordinateSystem: 'polar',
|
|
|
|
|
itemStyle: {
|
|
|
|
|
normal: {
|
|
|
|
|
color: colorList[index],
|
|
|
|
|
borderWidth: 2,
|
|
|
|
|
borderColor: colorList[index]
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
const option = {
|
|
|
|
|
title: [{
|
|
|
|
|
text: '{num|' + (totalNum < 0 ? 0 : totalNum) + '}',
|
|
|
|
|
x: '48%',
|
|
|
|
|
y: '35%',
|
|
|
|
|
textAlign: 'center',
|
|
|
|
|
textStyle: {
|
|
|
|
|
rich: {
|
|
|
|
|
num: {
|
|
|
|
|
fontSize: 28,
|
|
|
|
|
fontWeight: 'bold',
|
|
|
|
|
lineHeight: 40,
|
|
|
|
|
color: '#000000'
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}],
|
|
|
|
|
grid: {
|
|
|
|
|
bottom: '0%'
|
|
|
|
|
},
|
|
|
|
|
angleAxis: {
|
|
|
|
|
max: 100,
|
|
|
|
|
clockwise: true, // 逆时针
|
|
|
|
|
show: false
|
|
|
|
|
},
|
|
|
|
|
radiusAxis: {
|
|
|
|
|
type: 'category',
|
|
|
|
|
show: true,
|
|
|
|
|
axisLabel: {
|
|
|
|
|
show: false,
|
|
|
|
|
},
|
|
|
|
|
axisLine: {
|
|
|
|
|
show: false,
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
axisTick: {
|
|
|
|
|
show: false
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
polar: {
|
|
|
|
|
center: ['50%', '50%'],
|
|
|
|
|
radius: ['70%', '90%'],
|
|
|
|
|
},
|
|
|
|
|
series: seriesList
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
chart.clear();
|
|
|
|
|
chart.setOption(option);
|
|
|
|
|
return chart;
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Page({
|
|
|
|
|
data: {
|
|
|
|
|
baseImgUrl: app.FILE_SERVER_URL,
|
|
|
|
|
nineType: 0,
|
|
|
|
|
ec: {
|
|
|
|
|
lazyLoad: true
|
|
|
|
|
},
|
|
|
|
|
filterIndex: 0,
|
|
|
|
|
itemList: [{
|
|
|
|
|
icon: "icon_tab1",
|
|
|
|
|
name: "履职清单",
|
|
|
|
|
href: "/pages/duty/index/index"
|
|
|
|
|
},
|
|
|
|
|
// {
|
|
|
|
|
// icon: "icon_tab2",
|
|
|
|
|
// name: "专项任务",
|
|
|
|
|
// href: "/pages/task/index/index"
|
|
|
|
|
// },
|
|
|
|
|
{
|
|
|
|
|
icon: "icon_tab3",
|
|
|
|
|
name: "一企一档",
|
|
|
|
|
href: "/pages/ent-obj/index/index"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
icon: "icon_tab4",
|
|
|
|
|
name: "隐患核查",
|
|
|
|
|
href: "/pages/danger/list/index"
|
|
|
|
|
},
|
|
|
|
|
// {
|
|
|
|
|
// icon: "icon_tab5",
|
|
|
|
|
// name: "群防群治",
|
|
|
|
|
// href: "/pages/people/index/index",
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// icon: "icon-emergency",
|
|
|
|
|
// name: "应急管理",
|
|
|
|
|
// href: "/pages/emergency/index/index",
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// icon: "icon_tab6",
|
|
|
|
|
// name: "发布通知",
|
|
|
|
|
// href: "/pages/msg/push-index/index",
|
|
|
|
|
// },
|
|
|
|
|
],
|
|
|
|
|
filter: [{
|
|
|
|
|
lab: '今日数据',
|
|
|
|
|
val: 0
|
|
|
|
|
}, {
|
|
|
|
|
lab: '本月数据',
|
|
|
|
|
val: 1
|
|
|
|
|
}],
|
|
|
|
|
dLegend: [{
|
|
|
|
|
name: '已整改',
|
|
|
|
|
num: 0,
|
|
|
|
|
color: '#2678FF'
|
|
|
|
|
}, {
|
|
|
|
|
name: '整改中',
|
|
|
|
|
num: 0,
|
|
|
|
|
color: '#FF9C00'
|
|
|
|
|
}, {
|
|
|
|
|
name: '未整改',
|
|
|
|
|
num: 0,
|
|
|
|
|
color: '#FF4E00'
|
|
|
|
|
}],
|
|
|
|
|
|
|
|
|
|
// 数据统计
|
|
|
|
|
tab1: [{
|
|
|
|
|
icon: "icon_tab1",
|
|
|
|
|
name: "工作日志",
|
2024-01-30 17:39:39 +08:00
|
|
|
href: "/pages/statistic/g-z-r-z/index/index"
|
2024-01-29 17:42:38 +08:00
|
|
|
}, {
|
|
|
|
|
icon: "icon_tab1",
|
|
|
|
|
name: "工作统计",
|
2024-01-30 17:39:39 +08:00
|
|
|
href: "/pages/statistic/g-z-t-j/index/index"
|
2024-01-29 17:42:38 +08:00
|
|
|
}, {
|
|
|
|
|
icon: "icon_tab1",
|
|
|
|
|
name: "应急统计",
|
2024-01-30 17:39:39 +08:00
|
|
|
href: "/pages/statistic/y-j/index/index"
|
2024-01-29 17:42:38 +08:00
|
|
|
}, {
|
|
|
|
|
icon: "icon_tab1",
|
|
|
|
|
name: "基本信息",
|
2024-01-30 17:39:39 +08:00
|
|
|
href: "/pages/statistic/j-b-x-x/index/index"
|
2024-01-29 17:42:38 +08:00
|
|
|
}],
|
|
|
|
|
// 工作台
|
|
|
|
|
tab2: [{
|
|
|
|
|
icon: "icon_tab6",
|
|
|
|
|
name: "上报动态",
|
2024-01-30 17:39:39 +08:00
|
|
|
href: "/pages/work/s-b/index/index",
|
2024-01-29 17:42:38 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
icon: "icon_tab2",
|
|
|
|
|
name: "待办事项",
|
2024-01-30 17:39:39 +08:00
|
|
|
href: "/pages/work/d-b-s-x/index/index?id=0"
|
2024-01-29 17:42:38 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
icon: "icon_tab4",
|
|
|
|
|
name: "已办事项",
|
2024-01-30 17:39:39 +08:00
|
|
|
href: "/pages/work/d-b-s-x/index/index?id=1"
|
2024-01-29 17:42:38 +08:00
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
// 应急指挥
|
|
|
|
|
tab3: [{
|
|
|
|
|
icon: "icon_tab5",
|
|
|
|
|
name: "应急预案",
|
2024-01-30 17:39:39 +08:00
|
|
|
href: "/pages/emergency/y-a/index/index",
|
2024-01-29 17:42:38 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
icon: "icon_tab5",
|
|
|
|
|
name: "事件上报",
|
2024-01-30 17:39:39 +08:00
|
|
|
href: "/pages/emergency/s-b/index/index"
|
2024-01-29 17:42:38 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
icon: "icon_tab5",
|
|
|
|
|
name: "应急通讯录",
|
2024-01-30 17:39:39 +08:00
|
|
|
href: "/pages/emergency/t-x/index/index"
|
2024-01-29 17:42:38 +08:00
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
|
|
|
|
|
// 公告
|
|
|
|
|
notice: [
|
|
|
|
|
'https://mmbiz.qpic.cn/mmbiz_jpg/QFxgibMOdV09EdiaTK8M4z7EWPD0kor6RkRibJ9Zfte1GtdQyeTY7zMCeXnMd8LPeGHOX1icWcSB4C9BmdSia5Tjxpw/640?wx_fmt=jpeg&wxfrom=5&wx_lazy=1&wx_co=1',
|
|
|
|
|
'https://mmbiz.qpic.cn/mmbiz_png/QFxgibMOdV09NttuUu5jDN3YSKC2vRS8A3Yr35STiaibKwzGPAmvZr9dcqtqrSVFCph7jA0HL7T4JXhfOwMqRWI7A/640?wx_fmt=png&wxfrom=5&wx_lazy=1&wx_co=1',
|
|
|
|
|
'https://mmbiz.qpic.cn/mmbiz_png/QFxgibMOdV09enRGm9zrUxjTib9ibyfjY87diafrU5AljEONticxlcdzgS4ebQhQpNxeeHWTC9PjkjR0srSFvYria1Tw/640?wx_fmt=png&wxfrom=5&wx_lazy=1&wx_co=1',
|
|
|
|
|
'https://mmbiz.qpic.cn/mmbiz_png/QFxgibMOdV0icADgOhoofBPu01aYr9SrF1oHicDlckKibzKoEMneNibcNgsNXmmEX4jlTmVbSYMFuz4zYfVfNK20e8w/640?wx_fmt=png&wxfrom=5&wx_lazy=1&wx_co=1'
|
|
|
|
|
],
|
|
|
|
|
|
|
|
|
|
showPop: false,
|
|
|
|
|
msgData: null,
|
|
|
|
|
checkInfo: {},
|
|
|
|
|
|
|
|
|
|
userInfo: {}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 跳转
|
|
|
|
|
*/
|
|
|
|
|
toSkip: function (params) {
|
|
|
|
|
const item = params.currentTarget.dataset.item;
|
|
|
|
|
const url = params.currentTarget.dataset.url;
|
|
|
|
|
if (url || item?.href) {
|
|
|
|
|
wx.navigateTo({
|
|
|
|
|
url: url || item.href,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
2024-01-30 16:35:55 +08:00
|
|
|
* 获取banner
|
2024-01-29 17:42:38 +08:00
|
|
|
*/
|
2024-01-30 16:35:55 +08:00
|
|
|
getBanner: function () {
|
|
|
|
|
app.axios("GET", "app", "/work/wkDynamicsPage", {
|
2024-01-29 17:42:38 +08:00
|
|
|
page: 1,
|
2024-01-30 16:35:55 +08:00
|
|
|
limit: 4,
|
|
|
|
|
userId: app.globalData.userInfo.userId
|
|
|
|
|
}, false).then(res => {
|
2024-01-29 17:42:38 +08:00
|
|
|
if (res.code == 1) {
|
2024-01-30 16:35:55 +08:00
|
|
|
// this.data.notice = res.data.list;
|
|
|
|
|
// this.setData(this.data)
|
2024-01-29 17:42:38 +08:00
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onLoad(option) {
|
|
|
|
|
this.data.userInfo = app.globalData.userInfo;
|
2024-01-30 16:35:55 +08:00
|
|
|
this.getBanner();
|
2024-01-29 17:42:38 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onReady() {
|
|
|
|
|
chart = this.selectComponent('#d-chart')
|
|
|
|
|
this.setData(this.data)
|
|
|
|
|
},
|
|
|
|
|
})
|