diff --git a/src/views/equipment/timing-diagram/status/demo.js b/src/views/equipment/timing-diagram/status/chart.js
similarity index 93%
rename from src/views/equipment/timing-diagram/status/demo.js
rename to src/views/equipment/timing-diagram/status/chart.js
index 633a7f58..5bae9f6c 100644
--- a/src/views/equipment/timing-diagram/status/demo.js
+++ b/src/views/equipment/timing-diagram/status/chart.js
@@ -96,18 +96,7 @@ export default class GanttGraph {
this.currentGraphIndex = -2;
this.startTime = new Date(startTime);
// this.startTime = new Date(new Date('2023/10/8').toLocaleDateString());
- console.log('<> Gantt Created', this.startTime);
-
- // this.grid.push(this.makeGrid())
- // this.xAxis.push(...this.makeXaxis())
- // this.yAxis.push(...this.makeYaxis("设备1"))
- // this.series.push(...this.makeSeries({ equipmentName: "设备1" }))
-
- // this.grid.push(this.makeGrid())
- // this.xAxis.push(...this.makeXaxis())
- // this.yAxis.push(...this.makeYaxis("设备2"))
- // this.series.push(...this.makeSeries({ equipmentName: "设备2" }))
-
+ // console.log('<> Gantt Created', this.startTime);
}
// 构造一个新的 grid
@@ -223,8 +212,8 @@ export default class GanttGraph {
value: [0, bgStartTime, bgEndTime, 0],
tooltip: { show: false },
itemStyle: {
- color: '#ccc',
- opacity: 0.3,
+ color: '#F2F4F9',
+ // opacity: 0.3,
}
},
]
diff --git a/src/views/equipment/timing-diagram/status/gantt.js b/src/views/equipment/timing-diagram/status/gantt.js
deleted file mode 100644
index 0875c86f..00000000
--- a/src/views/equipment/timing-diagram/status/gantt.js
+++ /dev/null
@@ -1,235 +0,0 @@
-import * as echarts from 'echarts';
-
-
-function renderItem(params, api) {
- var categoryIndex = api.value(0);
- var start = api.coord([api.value(1), categoryIndex]);
- var end = api.coord([api.value(2), categoryIndex]);
- var height = api.size([0, 1])[1] * 1;
- // var height = api.size([0, 1])[1] * 0.8;
- // var height = 56;
- var rectShape = echarts.graphic.clipRectByRect(
- {
- x: start[0],
- y: start[1] - height / 2,
- width: end[0] - start[0],
- height: height,
- },
- {
- x: params.coordSys.x,
- y: params.coordSys.y,
- width: params.coordSys.width,
- height: params.coordSys.height,
- }
- );
- return (
- rectShape && {
- type: 'rect',
- transition: ['shape'],
- shape: rectShape,
- style: api.style(),
- }
- );
-}
-
-
-
-/** 颜色配置 */
-const types = [
- { name: '运行', color: '#5ad8a6' },
- { name: '故障', color: '#fc9c91' },
- { name: '计划停机', color: '#000' },
-];
-
-
-/** 从时间戳获取 startTime */
-function getStartTime(timestamp) {
- return new Date(new Date(timestamp).toLocaleDateString()).getTime();
-}
-
-
-
-export default class GanttGraph {
- constructor(el) {
- this.chart = null;
- this.el = el;
- /** 默认配置 */
- this.grid = {
- top: 32,
- left: 128,
- right: 128,
- bottom: 64,
- }
- this.tooltip = {
- formatter: function (params) {
- return (
- params.marker +
- params.name +
- ': ' +
- new Date(params.value[1]).toLocaleTimeString() +
- ' - ' +
- new Date(params.value[2]).toLocaleTimeString()
- );
- },
- }
- this.xAxis = {
- type: 'time',
- min: getStartTime(1691568181000), // <===
- max: getStartTime(1691568181000 + 3600 * 24 * 1000), // <===
- splitNumber: 10,
- axisLabel: {
- // rotate: -15,
- formatter: function (val) {
- return new Date(val).toLocaleTimeString();
- },
- },
- axisTick: {
- show: true,
- },
- splitLine: {
- show: false,
- },
- }
- this.yAxis = [
- {
- interval: 40,
- axisLine: {
- lineStyle: {
- color: '',
- },
- },
- axisLabel: {
- fontSize: 18,
- },
- axisTick: {
- show: false,
- },
- splitLine: {
- show: true,
- },
- // data: [], // <====
- data: ['设备1', '设备2', '设备3', '设备4'],
- },
- {
- axisLine: {
- lineStyle: {
- color: '',
- },
- },
- data: [],
- },
- ]
- this.series = [
- {
- type: 'custom',
- renderItem: renderItem,
- itemStyle: {
- opacity: 0.8,
- },
- encode: {
- x: [1, 2],
- y: 0,
- },
- // data: [], // <===
- data: [
- {
- name: '运行',
- value: [
- 0,
- 1691568181000,
- 1691568181000 + 60 * 60 * 1000,
- 60 * 10 * 1000,
- ],
- itemStyle: {
- normal: {
- color: types[0].color,
- },
- },
- },
- {
- name: '计划停机',
- value: [
- 0,
- 1691578581000,
- 1691578581000 + 10 * 60 * 1000,
- 60 * 10 * 1000,
- ],
- itemStyle: {
- normal: {
- color: types[2].color,
- },
- },
- },
- {
- name: '运行',
- value: [
- 1,
- 1691568181000,
- 1691568181000 + 60 * 60 * 1000,
- 60 * 10 * 1000,
- ],
- itemStyle: {
- normal: {
- color: types[0].color,
- },
- },
- },
- {
- name: '故障',
- value: [
- 2,
- 1691538181000,
- 1691538181000 + 60 * 60 * 1000,
- 60 * 10 * 1000,
- ],
- itemStyle: {
- normal: {
- color: types[1].color,
- },
- },
- },
- {
- name: '运行',
- value: [
- 2,
- 1691578181000,
- 1691578181000 + 90 * 60 * 1000,
- 90 * 10 * 1000,
- ],
- itemStyle: {
- normal: {
- color: types[0].color,
- },
- },
- },
- {
- name: '计划停机',
- value: [
- 3,
- 1691528181000,
- 1691528181000 + 240 * 60 * 1000,
- 240 * 10 * 1000,
- ],
- itemStyle: {
- normal: {
- color: types[2].color,
- },
- },
- },
- ],
- },
- ]
- }
-
- init() {
- this.chart = echarts.init(this.el);
- this.chart.setOption(this.getOption())
- }
-
- getOption() {
- const { grid, xAxis, yAxis, series, tooltip } = this;
- return {
- grid, xAxis, yAxis, series, tooltip
- }
- }
-}
\ No newline at end of file
diff --git a/src/views/equipment/timing-diagram/status/index copy.vue b/src/views/equipment/timing-diagram/status/index copy.vue
deleted file mode 100644
index afae93a2..00000000
--- a/src/views/equipment/timing-diagram/status/index copy.vue
+++ /dev/null
@@ -1,607 +0,0 @@
-
-
-
-
-
- 生产节拍时序图
-
-
-
-
-
-
-
-
- 设备状态时序图
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/views/equipment/timing-diagram/status/index.vue b/src/views/equipment/timing-diagram/status/index.vue
index 0eb330ff..ac6ddaf1 100644
--- a/src/views/equipment/timing-diagram/status/index.vue
+++ b/src/views/equipment/timing-diagram/status/index.vue
@@ -64,8 +64,7 @@