Commit 8b49f024 authored by 程恺文's avatar 程恺文
parents b54972b8 673ca250
......@@ -2,6 +2,18 @@
All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.4.64](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/ec_configurationview@1.4.63...@wisdom-components/ec_configurationview@1.4.64) (2023-06-06)
### Bug Fixes
- 组态增加表格组件 ([eea9ca4](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/eea9ca4b1f9c73424c5b6421f17f5bcabc6b718f))
## [1.4.63](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/ec_configurationview@1.4.62...@wisdom-components/ec_configurationview@1.4.63) (2023-06-06)
### Bug Fixes
- 组态增加表格组件 ([f585719](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/f58571910c9d862c18d530e2467f0daae8679025))
## [1.4.62](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/ec_configurationview@1.4.61...@wisdom-components/ec_configurationview@1.4.62) (2023-05-23)
### Bug Fixes
......
{
"name": "@wisdom-components/ec_configurationview",
"version": "1.4.62",
"version": "1.4.64",
"description": "> TODO: description",
"author": "tuqian <webtuqian@163.com>",
"homepage": "",
......
......@@ -13,7 +13,15 @@ import TopRotatingTool from './js/RotatingTool';
import BarLink from './js/BarLink';
import WaterFlowControlView from './js/WaterFlowControlView';
import { getSketchPadList, getSketchPadContent, getPointAddress, getHistoryInfo } from './apis';
import { deepCopy, hexToRgba, textStyle, querySkipUrl, isJson, stationData } from './js/utils';
import {
deepCopy,
hexToRgba,
textStyle,
querySkipUrl,
isJson,
stationData,
isNumber,
} from './js/utils';
import './index.less';
const goJS = go.GraphObject.make;
......@@ -287,7 +295,7 @@ const ConfigurationView = (props) => {
break;
}
} catch (err) {
console.log(err);
// console.log(err);
}
};
......@@ -311,7 +319,7 @@ const ConfigurationView = (props) => {
break;
}
} catch (err) {
console.log(err);
// console.log(err);
}
};
......@@ -1023,6 +1031,129 @@ const ConfigurationView = (props) => {
),
);
// 表格节点定义
myDiagram.nodeTemplateMap.add(
'tableCase',
goJS(
go.Node,
'Auto',
{ locationSpot: go.Spot.Center, zOrder: 1 },
new go.Binding('zOrder', 'zOrder').makeTwoWay(),
new go.Binding('location', 'loc', go.Point.parse).makeTwoWay(go.Point.stringify),
new go.Binding('angle').makeTwoWay(),
goJS(
go.Shape,
{
fill: 'white',
strokeWidth: 1,
stroke: '#808080',
},
new go.Binding('stroke').makeTwoWay(),
new go.Binding('strokeWidth').makeTwoWay(),
),
goJS(
go.Panel,
'Table',
{
padding: 0,
defaultRowSeparatorStroke: '#808080',
defaultColumnSeparatorStroke: '#808080',
defaultRowSeparatorStrokeWidth: 1,
defaultColumnSeparatorStrokeWidth: 1,
background: '#ffffff',
// defaultSeparatorPadding: new go.Margin(18, 0, 8, 0),
},
new go.Binding('background', 'fillColor').makeTwoWay(),
new go.Binding('defaultRowSeparatorStroke', 'stroke').makeTwoWay(),
new go.Binding('defaultRowSeparatorStrokeWidth', 'strokeWidth').makeTwoWay(),
new go.Binding('defaultColumnSeparatorStroke', 'stroke').makeTwoWay(),
new go.Binding('defaultColumnSeparatorStrokeWidth', 'strokeWidth').makeTwoWay(),
new go.Binding('itemArray', 'content').makeTwoWay(),
{
// 表内容
defaultAlignment: go.Spot.Left,
itemTemplate: goJS(
go.Panel,
'TableRow',
new go.Binding('itemArray', 'columns').makeTwoWay(),
{
itemTemplate: goJS(
go.Panel, // each of which as "attr" and "text" properties
'Spot',
{ background: 'transparent', alignment: go.Spot.Center },
new go.Binding('column').makeTwoWay(),
new go.Binding('columnSpan', 'cSpan').makeTwoWay(),
new go.Binding('rowSpan', 'rSpan').makeTwoWay(),
new go.Binding('padding', 'padding', function (v) {
if (v && isNumber(v)) return v;
const padding = v ? v.split(',') : null;
return padding
? new go.Margin(
padding[0] * 1 || 0,
padding[1] * 1 || 0,
padding[2] * 1 || 0,
padding[3] * 1 || 0,
)
: 0;
}).makeTwoWay(),
goJS(
go.Shape,
'RoundedRectanglePlus',
{
name: 'SHAPE',
fill: 'transparent',
stroke: '#ffffff',
strokeWidth: 0,
parameter1: 0,
},
new go.Binding('fill', 'background').makeTwoWay(),
new go.Binding('parameter1', 'radius').makeTwoWay(),
new go.Binding('stroke', 'bdColor').makeTwoWay(),
new go.Binding('strokeWidth', 'bdWidth').makeTwoWay(),
new go.Binding('width').makeTwoWay(),
new go.Binding('height').makeTwoWay(),
),
goJS(
go.TextBlock,
textStyle(),
{ editable: true },
{
// margin: new go.Margin(2, 10, 10, 2),
wrap: go.TextBlock.WrapFit,
textAlign: 'center',
font: 'bold 12px Helvetica, Arial, sans-serif',
stroke: '#454545',
},
new go.Binding('text').makeTwoWay(),
new go.Binding('font', 'style').makeTwoWay(),
new go.Binding('stroke', 'color').makeTwoWay(),
new go.Binding('textAlign', 'align').makeTwoWay(),
// new go.Binding('textSize', 'width', function(v) {
// return new go.Size(v, NaN);
// }),
new go.Binding('maxSize', 'width', function (v) {
try {
return new go.Size(v - 20, NaN);
} catch (err) {
return new go.Size(NaN, NaN);
}
}).makeTwoWay(),
new go.Binding('minSize', 'width', function (v) {
try {
return new go.Size(v - 20, NaN);
} catch (err) {
return new go.Size(NaN, NaN);
}
}).makeTwoWay(),
),
),
},
),
},
),
),
);
// img节点定义
myDiagram.nodeTemplateMap.add(
'imgCase',
......
......@@ -1538,6 +1538,129 @@ const ConfigurationView = (props) => {
),
);
// 表格节点定义
myDiagram.nodeTemplateMap.add(
'tableCase',
goJS(
go.Node,
'Auto',
{ locationSpot: go.Spot.Center, zOrder: 1 },
new go.Binding('zOrder', 'zOrder').makeTwoWay(),
new go.Binding('location', 'loc', go.Point.parse).makeTwoWay(go.Point.stringify),
new go.Binding('angle').makeTwoWay(),
goJS(
go.Shape,
{
fill: 'white',
strokeWidth: 1,
stroke: '#808080',
},
new go.Binding('stroke').makeTwoWay(),
new go.Binding('strokeWidth').makeTwoWay(),
),
goJS(
go.Panel,
'Table',
{
padding: 0,
defaultRowSeparatorStroke: '#808080',
defaultColumnSeparatorStroke: '#808080',
defaultRowSeparatorStrokeWidth: 1,
defaultColumnSeparatorStrokeWidth: 1,
background: '#ffffff',
// defaultSeparatorPadding: new go.Margin(18, 0, 8, 0),
},
new go.Binding('background', 'fillColor').makeTwoWay(),
new go.Binding('defaultRowSeparatorStroke', 'stroke').makeTwoWay(),
new go.Binding('defaultRowSeparatorStrokeWidth', 'strokeWidth').makeTwoWay(),
new go.Binding('defaultColumnSeparatorStroke', 'stroke').makeTwoWay(),
new go.Binding('defaultColumnSeparatorStrokeWidth', 'strokeWidth').makeTwoWay(),
new go.Binding('itemArray', 'content').makeTwoWay(),
{
// 表内容
defaultAlignment: go.Spot.Left,
itemTemplate: goJS(
go.Panel,
'TableRow',
new go.Binding('itemArray', 'columns').makeTwoWay(),
{
itemTemplate: goJS(
go.Panel, // each of which as "attr" and "text" properties
'Spot',
{ background: 'transparent', alignment: go.Spot.Center },
new go.Binding('column').makeTwoWay(),
new go.Binding('columnSpan', 'cSpan').makeTwoWay(),
new go.Binding('rowSpan', 'rSpan').makeTwoWay(),
new go.Binding('padding', 'padding', function (v) {
if (v && isNumber(v)) return v;
const padding = v ? v.split(',') : null;
return padding
? new go.Margin(
padding[0] * 1 || 0,
padding[1] * 1 || 0,
padding[2] * 1 || 0,
padding[3] * 1 || 0,
)
: 0;
}).makeTwoWay(),
goJS(
go.Shape,
'RoundedRectanglePlus',
{
name: 'SHAPE',
fill: 'transparent',
stroke: '#ffffff',
strokeWidth: 0,
parameter1: 0,
},
new go.Binding('fill', 'background').makeTwoWay(),
new go.Binding('parameter1', 'radius').makeTwoWay(),
new go.Binding('stroke', 'bdColor').makeTwoWay(),
new go.Binding('strokeWidth', 'bdWidth').makeTwoWay(),
new go.Binding('width').makeTwoWay(),
new go.Binding('height').makeTwoWay(),
),
goJS(
go.TextBlock,
textStyle(),
{ editable: true },
{
// margin: new go.Margin(2, 10, 10, 2),
wrap: go.TextBlock.WrapFit,
textAlign: 'center',
font: 'bold 12px Helvetica, Arial, sans-serif',
stroke: '#454545',
},
new go.Binding('text').makeTwoWay(),
new go.Binding('font', 'style').makeTwoWay(),
new go.Binding('stroke', 'color').makeTwoWay(),
new go.Binding('textAlign', 'align').makeTwoWay(),
// new go.Binding('textSize', 'width', function(v) {
// return new go.Size(v, NaN);
// }),
new go.Binding('maxSize', 'width', function (v) {
try {
return new go.Size(v - 20, NaN);
} catch (err) {
return new go.Size(NaN, NaN);
}
}).makeTwoWay(),
new go.Binding('minSize', 'width', function (v) {
try {
return new go.Size(v - 20, NaN);
} catch (err) {
return new go.Size(NaN, NaN);
}
}).makeTwoWay(),
),
),
},
),
},
),
),
);
// img节点定义
myDiagram.nodeTemplateMap.add(
'imgCase',
......
......@@ -2,6 +2,12 @@
All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [1.12.0](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/ec_historyview@1.11.2...@wisdom-components/ec_historyview@1.12.0) (2023-06-05)
### Features
- 修改历史曲线控件在指标缺失时报错问题 ([9cf6917](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/9cf69177e08bb32f4b07a93109d678b20f68f0fe))
## [1.11.2](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/ec_historyview@1.11.1...@wisdom-components/ec_historyview@1.11.2) (2023-05-17)
**Note:** Version bump only for package @wisdom-components/ec_historyview
......
{
"name": "@wisdom-components/ec_historyview",
"version": "1.11.2",
"version": "1.12.0",
"description": "> TODO: description",
"author": "cuijiahao <15927252954@163.com>",
"homepage": "",
......
......@@ -563,7 +563,7 @@ const HistoryView = (props) => {
aDom.click();
aDom.remove();
})
.catch((err) => {});
.catch((err) => { });
});
};
......@@ -613,7 +613,7 @@ const HistoryView = (props) => {
};
data.forEach((item, index) => {
const { stationCode, sensorName, dataModel } = item;
dataModel.forEach((data) => {
dataModel && dataModel.forEach((data) => {
const formatTime = moment(data.pt).format(format);
let time = formatTime;
......@@ -629,7 +629,7 @@ const HistoryView = (props) => {
data.forEach((child, index) => {
const { dataModel } = child;
const dataIndex = dataIndexAccess(child, index);
dataModel.forEach((value, j) => {
dataModel && dataModel.forEach((value, j) => {
const formatTime = moment(value.pt).format(format);
const dataRow = timeData[formatTime];
if (dataRow) {
......@@ -739,8 +739,8 @@ const HistoryView = (props) => {
const { dateFrom, dateTo } = dateRange?.[index] ?? {};
if (res.code === 0 && res.data.length) {
res.data.forEach((d) => {
d.dateFrom = dateFrom;
d.dateTo = dateTo;
d.dateFrom = dateFrom || '';
d.dateTo = dateTo || '';
});
deviceParams.forEach((p) => {
// 返回数据按查询指标顺序排序
......@@ -749,9 +749,14 @@ const HistoryView = (props) => {
const dataItem = res.data.find(
(d) => d.stationCode === p.deviceCode && d.sensorName === s,
);
dataItem.dateFrom = dateFrom;
dataItem.dateTo = dateTo;
return dataItem;
if (dataItem) {
dataItem.dateFrom = dateFrom || '';
dataItem.dateTo = dateTo || '';
return dataItem;
} else {
return {};
}
});
data = data.concat(list);
});
......@@ -833,7 +838,7 @@ const HistoryView = (props) => {
columns={columns}
{...tableProps}
pagination={false}
onChange={() => {}}
onChange={() => { }}
/>
) : (
<PandaEmpty />
......
......@@ -40,7 +40,7 @@ const nameFormatter = (data, contrast, contrastOption, nameWithSensor) => {
* @returns 图表系列数据, [[DateTime, value]]
*/
const dataAccessor = (data, contrast, contrastOption) => {
const { dataModel } = data;
const dataModel = data?.dataModel ?? [];
let _currentYear = moment().format('YYYY');
const formatStr =
contrastOption === 'day' ? `${_currentYear}-01-01 HH:mm:00` : `${_currentYear}-01-DD HH:mm:00`;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment