Skip to content

Commit 00ec678

Browse files
committed
优化界面/删除不需要的文件
1 parent 3a4dc4a commit 00ec678

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+550
-1570
lines changed

.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@
22
*-plus.sh
33
*_plus.html
44
*_plus.js
5-
*@plus.js
5+
*@plus.js
6+
*_plus.less
7+
*_plus.css
8+
*_plus.css.map

web/public/js/echarts/echarts.min.js

+20-45
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/public/js/utils.js

+291
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,272 @@ window.teaweb = {
604604
chart.setOption(option)
605605
chart.resize()
606606
},
607+
renderGaugeChart: function (options) {
608+
let chartId = options.id
609+
let name = options.name // 标题
610+
let min = options.min // 最小值
611+
let max = options.max // 最大值
612+
let value = options.value // 当前值
613+
let unit = options.unit // 单位
614+
let detail = options.detail // 说明文字
615+
let color = options.color // 颜色
616+
let startAngle = options.startAngle
617+
if (startAngle == null) {
618+
startAngle = 225
619+
}
620+
let endAngle = options.endAngle
621+
if (endAngle == null) {
622+
endAngle = -45
623+
}
624+
625+
color = this.chartColor(color)
626+
627+
let chartBox = document.getElementById(chartId)
628+
if (chartBox == null) {
629+
return
630+
}
631+
let chart = this.initChart(chartBox)
632+
633+
let option = {
634+
textStyle: {
635+
fontFamily: "Lato,'Helvetica Neue',Arial,Helvetica,sans-serif"
636+
},
637+
color: color,
638+
title: (name != null && name.length > 0) ? {
639+
text: name,
640+
top: 1,
641+
bottom: 0,
642+
x: "center",
643+
textStyle: {
644+
fontSize: 12,
645+
fontWeight: "bold",
646+
fontFamily: "Lato,'Helvetica Neue',Arial,Helvetica,sans-serif"
647+
}
648+
} : null,
649+
legend: {
650+
data: [""]
651+
},
652+
xAxis: {
653+
data: []
654+
},
655+
yAxis: {},
656+
series: [{
657+
name: "",
658+
type: "gauge",
659+
min: min,
660+
max: max,
661+
startAngle: startAngle,
662+
endAngle: endAngle,
663+
664+
data: [
665+
{
666+
"name": "",// 不显示名称
667+
"value": Math.round(value * 100) / 100
668+
}
669+
],
670+
radius: "100%",
671+
center: ["50%", (name != null && name.length > 0) ? "60%" : "50%"],
672+
673+
splitNumber: 5,
674+
splitLine: {
675+
length: 4
676+
},
677+
678+
axisLine: {
679+
lineStyle: {
680+
width: 4
681+
}
682+
},
683+
axisTick: {
684+
show: true,
685+
length: 2
686+
},
687+
axisLabel: {
688+
formatter: function (v) {
689+
return v;
690+
},
691+
textStyle: {
692+
fontSize: 8
693+
}
694+
},
695+
progress: {
696+
show: true,
697+
width: 4
698+
},
699+
detail: {
700+
formatter: function (v) {
701+
return unit;
702+
},
703+
textStyle: {
704+
fontSize: 12,
705+
fontWeight: "normal",
706+
fontFamily: "Arial,Helvetica,sans-serif",
707+
color: "grey"
708+
//lineHeight: 16
709+
},
710+
valueAnimation: true
711+
},
712+
713+
pointer: {
714+
width: 2
715+
}
716+
}],
717+
718+
grid: {
719+
left: -2,
720+
right: 0,
721+
bottom: 0,
722+
top: 0
723+
},
724+
axisPointer: {
725+
show: false
726+
},
727+
tooltip: {
728+
formatter: 'X:{b0} Y:{c0}',
729+
show: false
730+
},
731+
animation: true
732+
};
733+
734+
chart.setOption(option)
735+
},
736+
737+
renderPercentChart: function (options) {
738+
let chartId = options.id
739+
let color = this.chartColor(options.color)
740+
let value = options.value
741+
let name = options.name
742+
let total = options.total
743+
if (total == null) {
744+
total = 100
745+
}
746+
let unit = options.unit
747+
if (unit == null) {
748+
unit = ""
749+
}
750+
751+
let max = options.max
752+
if (max != null && max <= value) {
753+
max = null
754+
}
755+
let maxColor = this.chartColor(options.maxColor)
756+
let maxName = options.maxName
757+
758+
let chartBox = document.getElementById(chartId)
759+
if (chartBox == null) {
760+
return
761+
}
762+
let chart = this.initChart(chartBox)
763+
764+
let option = {
765+
tooltip: {
766+
formatter: "{a} <br/>{b} : {c}" + unit
767+
},
768+
series: [
769+
{
770+
name: name,
771+
max: total,
772+
type: "gauge",
773+
radius: "100%",
774+
detail: {
775+
formatter: "{value}",
776+
show: false,
777+
valueAnimation: true
778+
},
779+
data: [
780+
{
781+
value: value,
782+
name: name
783+
}
784+
],
785+
pointer: {
786+
show: false
787+
},
788+
splitLine: {
789+
show: false
790+
},
791+
axisTick: {
792+
show: false
793+
},
794+
axisLine: {
795+
show: true,
796+
lineStyle: {
797+
width: 4
798+
}
799+
},
800+
progress: {
801+
show: true,
802+
width: 4,
803+
itemStyle: {
804+
color: color
805+
}
806+
},
807+
splitNumber: {
808+
show: false
809+
},
810+
title: {
811+
show: false
812+
},
813+
startAngle: 270,
814+
endAngle: -90
815+
}
816+
]
817+
}
818+
819+
if (max != null) {
820+
option.series.push({
821+
name: maxName,
822+
max: total,
823+
type: "gauge",
824+
radius: "100%",
825+
detail: {
826+
formatter: "{value}",
827+
show: false,
828+
valueAnimation: true
829+
},
830+
data: [
831+
{
832+
value: max,
833+
name: maxName
834+
}
835+
],
836+
pointer: {
837+
show: false
838+
},
839+
splitLine: {
840+
show: false
841+
},
842+
axisTick: {
843+
show: false
844+
},
845+
axisLine: {
846+
show: true,
847+
lineStyle: {
848+
width: 4
849+
}
850+
},
851+
progress: {
852+
show: true,
853+
width: 4,
854+
itemStyle: {
855+
color: maxColor,
856+
opacity: 0.3
857+
}
858+
},
859+
splitNumber: {
860+
show: false
861+
},
862+
title: {
863+
show: false
864+
},
865+
startAngle: 270,
866+
endAngle: -90
867+
})
868+
}
869+
870+
chart.setOption(option)
871+
},
872+
607873
xRotation: function (chart, names) {
608874
let chartWidth = chart.getWidth()
609875
let width = 0
@@ -616,11 +882,17 @@ window.teaweb = {
616882

617883
return [40, -20]
618884
},
885+
chartMap: {}, // dom id => chart
619886
initChart: function (dom) {
887+
let domId = dom.getAttribute("id")
888+
if (domId != null && domId.length > 0 && typeof (this.chartMap[domId]) == "object") {
889+
return this.chartMap[domId]
890+
}
620891
let instance = echarts.init(dom)
621892
window.addEventListener("resize", function () {
622893
instance.resize()
623894
})
895+
this.chartMap[domId] = instance
624896
return instance
625897
},
626898
encodeHTML: function (s) {
@@ -629,6 +901,25 @@ window.teaweb = {
629901
s = s.replace(/>/g, "&gt;")
630902
s = s.replace(/"/, "&quot;")
631903
return s
904+
},
905+
chartColor: function (color) {
906+
if (color == null || color.length == 0) {
907+
color = "#5470c6"
908+
}
909+
910+
if (color == "red") {
911+
color = "#ee6666"
912+
}
913+
if (color == "yellow") {
914+
color = "#fac858"
915+
}
916+
if (color == "blue") {
917+
color = "#5470c6"
918+
}
919+
if (color == "green") {
920+
color = "#3ba272"
921+
}
922+
return color
632923
}
633924
}
634925

web/views/@default/@grids.css

+37
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/views/@default/@grids.css.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)