@cloudbase/weda-ui 2.0.10 → 2.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +9 -2
- package/src/mp/components/button/index.js +1 -1
- package/src/mp/components/button/index.wxml +19 -19
- package/src/mp/components/calendar/index.js +64 -37
- package/src/mp/components/calendar/index.wxml +28 -8
- package/src/mp/components/carousel/index.wxml +30 -3
- package/src/mp/components/chart/bar/index.js +1 -2
- package/src/mp/components/chart/bar/index.wxml +7 -2
- package/src/mp/components/chart/common/config/bar.js +1 -1
- package/src/mp/components/chart/common/core/eChartBar.js +29 -34
- package/src/mp/components/chart/common/core/eChartBase.js +46 -32
- package/src/mp/components/chart/common/core/eChartLine.js +34 -40
- package/src/mp/components/chart/common/core/eChartPie.js +12 -9
- package/src/mp/components/chart/ec-canvas/ec-canvas.wxml +19 -2
- package/src/mp/components/chart/ec-canvas/wx-canvas.js +24 -22
- package/src/mp/components/chart/line/index.js +2 -2
- package/src/mp/components/chart/line/index.wxml +7 -2
- package/src/mp/components/chart/pie/index.js +1 -1
- package/src/mp/components/chart/pie/index.wxml +7 -3
- package/src/mp/components/chart/statisticsCard/index.wxml +5 -1
- package/src/mp/components/dataView/index.wxml +2 -2
- package/src/mp/components/form/checkbox/index.js +10 -6
- package/src/mp/components/form/checkbox/index.wxml +26 -23
- package/src/mp/components/form/form/index.wxml +3 -3
- package/src/mp/components/form/formcell/index.wxml +9 -9
- package/src/mp/components/form/formcell/index.wxss +1 -1
- package/src/mp/components/form/input/index.js +3 -3
- package/src/mp/components/form/input/index.wxml +36 -30
- package/src/mp/components/form/input/index.wxss +2 -2
- package/src/mp/components/form/location/components/mapChoose/index.wxml +59 -12
- package/src/mp/components/form/location/index.wxml +39 -7
- package/src/mp/components/form/radio/index.js +9 -5
- package/src/mp/components/form/radio/index.wxml +23 -23
- package/src/mp/components/form/select/index.js +156 -97
- package/src/mp/components/form/select/index.wxml +39 -37
- package/src/mp/components/form/select/index.wxss +1 -1
- package/src/mp/components/form/select/region/index.js +18 -12
- package/src/mp/components/form/switch/index.wxml +20 -16
- package/src/mp/components/form/textarea/index.wxml +12 -8
- package/src/mp/components/form/tips/index.wxml +1 -3
- package/src/mp/components/form/uploader/index.js +1 -1
- package/src/mp/components/form/uploader/index.wxml +19 -18
- package/src/mp/components/form/uploader/weui-uploader.js +210 -200
- package/src/mp/components/form/uploader/weui-uploader.wxml +81 -38
- package/src/mp/components/form/uploaderFile/index.js +5 -4
- package/src/mp/components/form/uploaderFile/index.wxml +97 -41
- package/src/mp/components/graphicCard/index.js +26 -24
- package/src/mp/components/graphicCard/index.wxml +30 -6
- package/src/mp/components/image/index.wxml +25 -18
- package/src/mp/components/image/index.wxss +3 -1
- package/src/mp/components/listView/index.wxml +34 -11
- package/src/mp/components/lottery/index.wxml +29 -7
- package/src/mp/components/lottery/index.wxss +31 -25
- package/src/mp/components/navLayout/index.wxml +29 -7
- package/src/mp/components/navigationBar/index.wxml +162 -53
- package/src/mp/components/swiper/index.wxml +12 -7
- package/src/mp/components/tabs/index.js +14 -10
- package/src/mp/components/tabs/index.wxml +2 -1
- package/src/mp/components/text/index.wxml +2 -1
- package/src/mp/components/text/index.wxss +1 -1
- package/src/mp/components/wxOpenApi/phone/index.wxml +11 -12
- package/src/mp/components/wxOpenApi/phoneCode/index.wxml +11 -12
- package/src/mp/components/wxOpenApi/share/index.wxml +11 -12
- package/src/mp/components/wxOpenApi/userInfo/index.wxml +10 -11
- package/src/mp/style/weda-ui.wxss +8 -3
- package/src/mp/utils/deepEqual.js +37 -37
- package/src/mp/utils/destr.js +41 -40
- package/src/mp/utils/dr_square_point.js +10 -6
- package/src/setupTests.js +13 -13
- package/src/web/components/button/index.tsx +44 -40
- package/src/web/components/carousel/index.tsx +1 -1
- package/src/web/components/chart/common/config/bar.js +1 -1
- package/src/web/components/chart/common/core/eChartBar.js +28 -34
- package/src/web/components/chart/common/core/eChartLine.js +34 -40
- package/src/web/components/chart/common/core/eChartPie.js +12 -9
- package/src/web/components/form/form/index.tsx +5 -5
- package/src/web/components/form/formcell/index.css +5 -1
- package/src/web/components/form/formcell/index.tsx +1 -1
- package/src/web/components/form/select/h5.tsx +154 -103
- package/src/web/components/form/select/index.css +0 -3
- package/src/web/components/form/textarea/index.tsx +1 -1
- package/src/web/components/form/uploader/uploader.h5.tsx +26 -20
- package/src/web/components/image/index.tsx +1 -1
- package/src/web/components/link/index.tsx +1 -1
- package/src/web/components/navLayout/index.tsx +1 -1
- package/src/web/components/navigationBar/index.tsx +2 -2
- package/src/web/components/picker/timePicker.tsx +1 -1
- package/src/web/components/text/index.tsx +13 -14
- package/src/web/utils/isObjectEqual.js +2 -1
- package/src/web/weda-ui.css +4 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import getConfig from '../config/global';
|
|
2
|
-
import {callWedaApi, callDataSource} from '../../../../utils/tcb';
|
|
2
|
+
import { callWedaApi, callDataSource } from '../../../../utils/tcb';
|
|
3
3
|
/**
|
|
4
4
|
* 图表处理基类
|
|
5
5
|
* @author loonglong
|
|
@@ -30,28 +30,29 @@ class EchartBase {
|
|
|
30
30
|
dimension: {},
|
|
31
31
|
group: {},
|
|
32
32
|
};
|
|
33
|
-
if (filterData && filterData.length > 0) {
|
|
33
|
+
if (filterData && filterData.length > 0) {
|
|
34
|
+
// 协议转化,把首字母改成大写
|
|
34
35
|
objReturnData.where = filterData.map((val) => {
|
|
35
36
|
let arrLogicData = val.logicData;
|
|
36
37
|
if (val.logicData && val.logicData.length > 0) {
|
|
37
|
-
arrLogicData = val.logicData.map((mval)=>{
|
|
38
|
+
arrLogicData = val.logicData.map((mval) => {
|
|
38
39
|
return {
|
|
39
40
|
Key: mval.key,
|
|
40
41
|
Rel: mval.rel,
|
|
41
42
|
Value: mval.value,
|
|
42
43
|
Logic: mval.logic,
|
|
43
44
|
Extra: {
|
|
44
|
-
Type:mval?.extra?.type,
|
|
45
|
-
Format:mval?.extra?.format,
|
|
46
|
-
IsExpression:mval.extra.isExpression,
|
|
45
|
+
Type: mval?.extra?.type,
|
|
46
|
+
Format: mval?.extra?.format,
|
|
47
|
+
IsExpression: mval.extra.isExpression,
|
|
47
48
|
},
|
|
48
|
-
ValueType:mval.valueType,
|
|
49
|
-
Expression:mval.expression
|
|
49
|
+
ValueType: mval.valueType,
|
|
50
|
+
Expression: mval.expression,
|
|
50
51
|
};
|
|
51
52
|
});
|
|
52
53
|
}
|
|
53
54
|
return {
|
|
54
|
-
GroupLogic:val.groupLogic,
|
|
55
|
+
GroupLogic: val.groupLogic,
|
|
55
56
|
LogicData: arrLogicData,
|
|
56
57
|
};
|
|
57
58
|
});
|
|
@@ -149,20 +150,20 @@ class EchartBase {
|
|
|
149
150
|
break;
|
|
150
151
|
}
|
|
151
152
|
}
|
|
152
|
-
setLegend({ isLegend, legend= 'top'}) {
|
|
153
|
+
setLegend({ isLegend, legend = 'top' }) {
|
|
153
154
|
this.config.legend.show = isLegend;
|
|
154
155
|
switch (legend) {
|
|
155
|
-
case 'top'
|
|
156
|
+
case 'top':
|
|
156
157
|
this.config.legend.orient = 'horizontal';
|
|
157
158
|
this.config.legend.x = 'center';
|
|
158
159
|
this.config.legend.top = '6%';
|
|
159
160
|
break;
|
|
160
|
-
case 'left'
|
|
161
|
+
case 'left':
|
|
161
162
|
this.config.legend.orient = 'vertical';
|
|
162
163
|
this.config.legend.top = '30%';
|
|
163
164
|
this.config.legend.left = '1%';
|
|
164
165
|
break;
|
|
165
|
-
case 'right'
|
|
166
|
+
case 'right':
|
|
166
167
|
this.config.legend.orient = 'vertical';
|
|
167
168
|
this.config.legend.top = '30%';
|
|
168
169
|
this.config.legend.right = '-6%';
|
|
@@ -186,11 +187,11 @@ class EchartBase {
|
|
|
186
187
|
sortedXAxisData.forEach((itemSource) => {
|
|
187
188
|
let value = itemSource.XLabel.Value;
|
|
188
189
|
if (formatType === 'datetime') {
|
|
189
|
-
value =
|
|
190
|
+
value = this.formatTime(itemSource.XLabel.Value, 'dt');
|
|
190
191
|
} else if (formatType === 'date') {
|
|
191
|
-
value =
|
|
192
|
+
value = this.formatTime(itemSource.XLabel.Value, 'd');
|
|
192
193
|
} else if (formatType === 'time') {
|
|
193
|
-
value =
|
|
194
|
+
value = this.formatTime(itemSource.XLabel.Value, 't');
|
|
194
195
|
}
|
|
195
196
|
xAxisData.push(value);
|
|
196
197
|
});
|
|
@@ -201,16 +202,19 @@ class EchartBase {
|
|
|
201
202
|
|
|
202
203
|
sortXAxisData(arrData, formatType = '') {
|
|
203
204
|
let xFields = [...arrData];
|
|
204
|
-
if(['datetime', 'date', 'time'].includes(formatType)) {
|
|
205
|
+
if (['datetime', 'date', 'time'].includes(formatType)) {
|
|
205
206
|
xFields.sort((a, b) => {
|
|
206
|
-
if(a.XLabel.Value && b.XLabel.Value
|
|
207
|
-
return
|
|
207
|
+
if (a.XLabel.Value && b.XLabel.Value) {
|
|
208
|
+
return (
|
|
209
|
+
new Date(a.XLabel.Value).getTime() -
|
|
210
|
+
new Date(b.XLabel.Value).getTime()
|
|
211
|
+
);
|
|
208
212
|
}
|
|
209
213
|
// 产品需求空值放最后
|
|
210
|
-
if(!a.XLabel.Value) {
|
|
214
|
+
if (!a.XLabel.Value) {
|
|
211
215
|
return 1;
|
|
212
216
|
}
|
|
213
|
-
if(!b.XLabel.Value) {
|
|
217
|
+
if (!b.XLabel.Value) {
|
|
214
218
|
return -1;
|
|
215
219
|
}
|
|
216
220
|
});
|
|
@@ -224,16 +228,17 @@ class EchartBase {
|
|
|
224
228
|
* @param { string } timeType 需要格式化的类型 dt:日期时间,d:日期,t:时间
|
|
225
229
|
* @returns { string } 格式化结果
|
|
226
230
|
*/
|
|
227
|
-
formatTime(time, timeType='dt') {
|
|
228
|
-
if(typeof time === 'undefined' || time === null) {
|
|
231
|
+
formatTime(time, timeType = 'dt') {
|
|
232
|
+
if (typeof time === 'undefined' || time === null) {
|
|
229
233
|
return '空';
|
|
230
234
|
}
|
|
231
|
-
if (typeof
|
|
235
|
+
if (typeof time === 'string') {
|
|
236
|
+
// 如果是字符串,代表后台返回的就是格式化的时间格式,则这里不再做格式化处理
|
|
232
237
|
return time;
|
|
233
238
|
}
|
|
234
239
|
const date = new Date(time + 8 * 3600 * 1000);
|
|
235
240
|
let startNum = 0;
|
|
236
|
-
let endNum =
|
|
241
|
+
let endNum = 19;
|
|
237
242
|
if (timeType === 'd') {
|
|
238
243
|
startNum = 0;
|
|
239
244
|
endNum = 10;
|
|
@@ -293,13 +298,18 @@ class EchartBase {
|
|
|
293
298
|
}
|
|
294
299
|
// 显示X轴刻度线
|
|
295
300
|
setIsXaxisAxisTickShow({ isXaxisAxisTickShow }) {
|
|
296
|
-
this.config.xAxis.axisTick = { show
|
|
301
|
+
this.config.xAxis.axisTick = { show: isXaxisAxisTickShow };
|
|
297
302
|
}
|
|
298
303
|
// X 轴文字倾斜
|
|
299
304
|
// X 轴文字倾斜
|
|
300
|
-
setIsXaxisAxisLabelRotate({
|
|
305
|
+
setIsXaxisAxisLabelRotate({
|
|
306
|
+
isXaxisAxisLabelRotate,
|
|
307
|
+
xStatistics,
|
|
308
|
+
angle = 30,
|
|
309
|
+
}) {
|
|
301
310
|
this.config.xAxis.axisLabel.rotate = isXaxisAxisLabelRotate ? angle : 0;
|
|
302
|
-
if (isXaxisAxisLabelRotate || xStatistics) {
|
|
311
|
+
if (isXaxisAxisLabelRotate || xStatistics) {
|
|
312
|
+
// 如果X轴是时间类型,自动斜30度展示
|
|
303
313
|
this.config.xAxis.axisLabel.rotate = angle;
|
|
304
314
|
} else {
|
|
305
315
|
this.config.xAxis.axisLabel.rotate = 0;
|
|
@@ -311,8 +321,10 @@ class EchartBase {
|
|
|
311
321
|
isYAxisSplitlineLinestyleWidth,
|
|
312
322
|
yAxisSplitlineLinestyleType,
|
|
313
323
|
}) {
|
|
314
|
-
this.config.yAxis.splitLine = {lineStyle:{}};
|
|
315
|
-
this.config.yAxis.splitLine.lineStyle.width =
|
|
324
|
+
this.config.yAxis.splitLine = { lineStyle: {} };
|
|
325
|
+
this.config.yAxis.splitLine.lineStyle.width = isYAxisSplitlineLinestyleWidth
|
|
326
|
+
? 1
|
|
327
|
+
: 0;
|
|
316
328
|
this.config.yAxis.splitLine.lineStyle.type = yAxisSplitlineLinestyleType;
|
|
317
329
|
}
|
|
318
330
|
// 显示 Y 轴刻度 最大值,最小值
|
|
@@ -336,7 +348,9 @@ class EchartBase {
|
|
|
336
348
|
*/
|
|
337
349
|
setEmptyValue(xIsCountEmpty) {
|
|
338
350
|
if (!xIsCountEmpty) {
|
|
339
|
-
const nonEmpty = this.config.xAxis.data.filter(
|
|
351
|
+
const nonEmpty = this.config.xAxis.data.filter(
|
|
352
|
+
(item) => item !== undefined && item !== null
|
|
353
|
+
);
|
|
340
354
|
this.config.xAxis.data = nonEmpty;
|
|
341
355
|
}
|
|
342
356
|
}
|
|
@@ -349,7 +363,7 @@ class EchartBase {
|
|
|
349
363
|
removeEmpty(arrXAxis) {
|
|
350
364
|
const arrNewxAxis = [];
|
|
351
365
|
if (arrXAxis.length > 0) {
|
|
352
|
-
for(let i = 0; i < arrXAxis.length; i++) {
|
|
366
|
+
for (let i = 0; i < arrXAxis.length; i++) {
|
|
353
367
|
if (arrXAxis[i]) {
|
|
354
368
|
arrNewxAxis.push(arrXAxis[i]);
|
|
355
369
|
}
|
|
@@ -36,7 +36,7 @@ class EchartLine extends EchartBase {
|
|
|
36
36
|
name,
|
|
37
37
|
methodName,
|
|
38
38
|
type,
|
|
39
|
-
params
|
|
39
|
+
params
|
|
40
40
|
);
|
|
41
41
|
// 获取 x 轴数据
|
|
42
42
|
const sortedXAxisData = this.sortXAxisData(arrSourData, xField.format);
|
|
@@ -57,12 +57,18 @@ class EchartLine extends EchartBase {
|
|
|
57
57
|
},
|
|
58
58
|
data: [],
|
|
59
59
|
};
|
|
60
|
-
sortedXAxisData.forEach((itemSource,index) => {
|
|
60
|
+
sortedXAxisData.forEach((itemSource, index) => {
|
|
61
61
|
this.config.series[j].name = itemSource.YLabels[j].Cn_Name;
|
|
62
|
-
if (
|
|
62
|
+
if (
|
|
63
|
+
(!itemSource.YLabels[j].Value === undefined ||
|
|
64
|
+
itemSource.YLabels[j].Value === null) &&
|
|
65
|
+
!xIsCountEmpty
|
|
66
|
+
) {
|
|
63
67
|
arrXisCountEmptyIndex.push(index);
|
|
64
68
|
} else {
|
|
65
|
-
const value = itemSource.YLabels[j].Value
|
|
69
|
+
const value = itemSource.YLabels[j].Value
|
|
70
|
+
? itemSource.YLabels[j].Value
|
|
71
|
+
: 0;
|
|
66
72
|
this.config.series[j].data.push(value);
|
|
67
73
|
}
|
|
68
74
|
});
|
|
@@ -90,38 +96,28 @@ class EchartLine extends EchartBase {
|
|
|
90
96
|
// 组装图表需要的数据
|
|
91
97
|
const groupNames = Object.keys(objGroupKey);
|
|
92
98
|
this.config.series = groupNames.map((groupKey) => {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
});
|
|
110
|
-
this.config.tooltip.formatter = params => (
|
|
111
|
-
`${params.data.dimensionality
|
|
112
|
-
}\r\n${
|
|
113
|
-
params.data.name
|
|
114
|
-
}\r\n${
|
|
115
|
-
params.seriesName
|
|
116
|
-
}:${
|
|
117
|
-
params.value}`
|
|
118
|
-
);
|
|
99
|
+
// groupKey分组字段中文名
|
|
100
|
+
const serie = {
|
|
101
|
+
name: groupKey,
|
|
102
|
+
connectNulls: true,
|
|
103
|
+
data: this.getSeriesDataGroup(arrXaxisData, objGroupKey[groupKey]),
|
|
104
|
+
type: 'line',
|
|
105
|
+
smooth: true,
|
|
106
|
+
showSymbol: true, // 是否显示线条上数据标签
|
|
107
|
+
label: {
|
|
108
|
+
show: true, // 显示线条上的数据
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
return serie;
|
|
112
|
+
});
|
|
113
|
+
this.config.tooltip.formatter = (params) =>
|
|
114
|
+
`${params.data.dimensionality}\r\n${params.data.name}\r\n${params.seriesName}:${params.value}`;
|
|
119
115
|
}
|
|
120
116
|
}
|
|
121
117
|
}
|
|
122
118
|
setChartType({ chartType }) {
|
|
123
|
-
this.config.series.length > 0
|
|
124
|
-
|
|
119
|
+
this.config.series.length > 0 &&
|
|
120
|
+
this.config.series.forEach((itemSeries) => {
|
|
125
121
|
itemSeries.smooth = chartType !== 'line';
|
|
126
122
|
});
|
|
127
123
|
}
|
|
@@ -132,19 +128,17 @@ class EchartLine extends EchartBase {
|
|
|
132
128
|
isUnit,
|
|
133
129
|
unit,
|
|
134
130
|
decimalDigits,
|
|
135
|
-
suffix
|
|
131
|
+
suffix,
|
|
136
132
|
}) {
|
|
137
133
|
decimalDigits = decimalDigits < 0 ? 0 : decimalDigits;
|
|
138
|
-
this.config.series.length > 0
|
|
139
|
-
|
|
134
|
+
this.config.series.length > 0 &&
|
|
135
|
+
this.config.series.forEach((itemSeries) => {
|
|
140
136
|
itemSeries.showSymbol = isSeriesShowSymbol;
|
|
141
137
|
itemSeries.label.show = isSeriesShowSymbol;
|
|
142
138
|
if (isUnit) {
|
|
143
139
|
itemSeries.label.formatter = (params) => {
|
|
144
140
|
const objNewValue = this.getValueByUnit(params.value, unit);
|
|
145
|
-
return (
|
|
146
|
-
`${objNewValue.toFixed(decimalDigits)}${suffix}`
|
|
147
|
-
);
|
|
141
|
+
return `${objNewValue.toFixed(decimalDigits)}${suffix}`;
|
|
148
142
|
};
|
|
149
143
|
}
|
|
150
144
|
});
|
|
@@ -188,7 +182,7 @@ class EchartLine extends EchartBase {
|
|
|
188
182
|
isUnit,
|
|
189
183
|
unit,
|
|
190
184
|
decimalDigits,
|
|
191
|
-
suffix
|
|
185
|
+
suffix,
|
|
192
186
|
}) {
|
|
193
187
|
if (dataSource) {
|
|
194
188
|
await this.setSourceData({
|
|
@@ -221,7 +215,7 @@ class EchartLine extends EchartBase {
|
|
|
221
215
|
isUnit,
|
|
222
216
|
unit,
|
|
223
217
|
decimalDigits,
|
|
224
|
-
suffix
|
|
218
|
+
suffix,
|
|
225
219
|
});
|
|
226
220
|
}
|
|
227
221
|
}
|
|
@@ -32,7 +32,7 @@ class EchartPie extends EchartBase {
|
|
|
32
32
|
name,
|
|
33
33
|
methodName,
|
|
34
34
|
type,
|
|
35
|
-
params
|
|
35
|
+
params
|
|
36
36
|
);
|
|
37
37
|
// 获取 x 轴数据
|
|
38
38
|
if (arrSourData.length >= 0) {
|
|
@@ -59,8 +59,8 @@ class EchartPie extends EchartBase {
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
setChartType({ chartType }) {
|
|
62
|
-
this.config.series.length > 0
|
|
63
|
-
|
|
62
|
+
this.config.series.length > 0 &&
|
|
63
|
+
this.config.series.forEach((itemSeries) => {
|
|
64
64
|
if (chartType === 'pie') {
|
|
65
65
|
itemSeries.radius = '70%';
|
|
66
66
|
} else {
|
|
@@ -76,7 +76,7 @@ class EchartPie extends EchartBase {
|
|
|
76
76
|
isUnit,
|
|
77
77
|
unit,
|
|
78
78
|
decimalDigits,
|
|
79
|
-
suffix
|
|
79
|
+
suffix,
|
|
80
80
|
}) {
|
|
81
81
|
decimalDigits = decimalDigits < 0 ? 0 : decimalDigits;
|
|
82
82
|
let show = false;
|
|
@@ -92,10 +92,12 @@ class EchartPie extends EchartBase {
|
|
|
92
92
|
} else {
|
|
93
93
|
this.config.series[0].label.normal.formatter = (objValue) => {
|
|
94
94
|
let reData = '';
|
|
95
|
-
if (isSeriesShowSymbol) {
|
|
95
|
+
if (isSeriesShowSymbol) {
|
|
96
|
+
// 显示数值
|
|
96
97
|
reData = objValue.value;
|
|
97
98
|
}
|
|
98
|
-
if (isUnit) {
|
|
99
|
+
if (isUnit) {
|
|
100
|
+
// 显示单位
|
|
99
101
|
if (unit) {
|
|
100
102
|
const objNewValue = this.getValueByUnit(objValue.value, unit);
|
|
101
103
|
reData = `${objNewValue.toFixed(decimalDigits)}${suffix}`;
|
|
@@ -109,7 +111,8 @@ class EchartPie extends EchartBase {
|
|
|
109
111
|
};
|
|
110
112
|
});
|
|
111
113
|
}
|
|
112
|
-
if (isPercent) {
|
|
114
|
+
if (isPercent) {
|
|
115
|
+
// 显示百分比
|
|
113
116
|
reData = `${reData}(${objValue.percent}%)`;
|
|
114
117
|
}
|
|
115
118
|
return reData;
|
|
@@ -135,7 +138,7 @@ class EchartPie extends EchartBase {
|
|
|
135
138
|
isUnit,
|
|
136
139
|
unit,
|
|
137
140
|
decimalDigits,
|
|
138
|
-
suffix
|
|
141
|
+
suffix,
|
|
139
142
|
}) {
|
|
140
143
|
if (dataSource) {
|
|
141
144
|
await this.setSourceData({
|
|
@@ -158,7 +161,7 @@ class EchartPie extends EchartBase {
|
|
|
158
161
|
isUnit,
|
|
159
162
|
unit,
|
|
160
163
|
decimalDigits,
|
|
161
|
-
suffix
|
|
164
|
+
suffix,
|
|
162
165
|
});
|
|
163
166
|
}
|
|
164
167
|
}
|
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
<!-- 新的:接口对齐了H5 -->
|
|
2
|
-
<canvas
|
|
2
|
+
<canvas
|
|
3
|
+
wx:if="{{isUseNewCanvas}}"
|
|
4
|
+
type="2d"
|
|
5
|
+
class="ec-canvas"
|
|
6
|
+
canvas-id="{{ canvasId }}"
|
|
7
|
+
bindinit="init"
|
|
8
|
+
bindtouchstart="{{ ec.disableTouch ? '' : 'touchStart' }}"
|
|
9
|
+
bindtouchmove="{{ ec.disableTouch ? '' : 'touchMove' }}"
|
|
10
|
+
bindtouchend="{{ ec.disableTouch ? '' : 'touchEnd' }}"
|
|
11
|
+
></canvas>
|
|
3
12
|
<!-- 旧的 -->
|
|
4
|
-
<canvas
|
|
13
|
+
<canvas
|
|
14
|
+
wx:else
|
|
15
|
+
class="ec-canvas"
|
|
16
|
+
canvas-id="{{ canvasId }}"
|
|
17
|
+
bindinit="init"
|
|
18
|
+
bindtouchstart="{{ ec.disableTouch ? '' : 'touchStart' }}"
|
|
19
|
+
bindtouchmove="{{ ec.disableTouch ? '' : 'touchMove' }}"
|
|
20
|
+
bindtouchend="{{ ec.disableTouch ? '' : 'touchEnd' }}"
|
|
21
|
+
></canvas>
|
|
@@ -6,8 +6,7 @@ class WxCanvas {
|
|
|
6
6
|
this.isNew = isNew;
|
|
7
7
|
if (isNew) {
|
|
8
8
|
this.canvasNode = canvasNode;
|
|
9
|
-
}
|
|
10
|
-
else {
|
|
9
|
+
} else {
|
|
11
10
|
this._initStyle(ctx);
|
|
12
11
|
}
|
|
13
12
|
|
|
@@ -60,26 +59,31 @@ class WxCanvas {
|
|
|
60
59
|
|
|
61
60
|
_initEvent() {
|
|
62
61
|
this.event = {};
|
|
63
|
-
const eventNames = [
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
62
|
+
const eventNames = [
|
|
63
|
+
{
|
|
64
|
+
wxName: 'touchStart',
|
|
65
|
+
ecName: 'mousedown',
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
wxName: 'touchMove',
|
|
69
|
+
ecName: 'mousemove',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
wxName: 'touchEnd',
|
|
73
|
+
ecName: 'mouseup',
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
wxName: 'touchEnd',
|
|
77
|
+
ecName: 'click',
|
|
78
|
+
},
|
|
79
|
+
];
|
|
76
80
|
|
|
77
|
-
eventNames.forEach(name => {
|
|
78
|
-
this.event[name.wxName] = e => {
|
|
81
|
+
eventNames.forEach((name) => {
|
|
82
|
+
this.event[name.wxName] = (e) => {
|
|
79
83
|
const touch = e.touches[0];
|
|
80
84
|
this.chart.getZr().handler.dispatch(name.ecName, {
|
|
81
85
|
zrX: name.wxName === 'tap' ? touch.clientX : touch.x,
|
|
82
|
-
zrY: name.wxName === 'tap' ? touch.clientY : touch.y
|
|
86
|
+
zrY: name.wxName === 'tap' ? touch.clientY : touch.y,
|
|
83
87
|
});
|
|
84
88
|
};
|
|
85
89
|
});
|
|
@@ -93,13 +97,11 @@ class WxCanvas {
|
|
|
93
97
|
}
|
|
94
98
|
|
|
95
99
|
get width() {
|
|
96
|
-
if (this.canvasNode)
|
|
97
|
-
return this.canvasNode.width;
|
|
100
|
+
if (this.canvasNode) return this.canvasNode.width;
|
|
98
101
|
return 0;
|
|
99
102
|
}
|
|
100
103
|
get height() {
|
|
101
|
-
if (this.canvasNode)
|
|
102
|
-
return this.canvasNode.height;
|
|
104
|
+
if (this.canvasNode) return this.canvasNode.height;
|
|
103
105
|
return 0;
|
|
104
106
|
}
|
|
105
107
|
}
|
|
@@ -237,11 +237,11 @@ Component({
|
|
|
237
237
|
},
|
|
238
238
|
observers: {
|
|
239
239
|
// 当参数变化时
|
|
240
|
-
'**': async function() {
|
|
240
|
+
'**': async function () {
|
|
241
241
|
const objEChartLine = new EchartLine();
|
|
242
242
|
await objEChartLine.setOptions(this.properties);
|
|
243
243
|
const options = objEChartLine.getOptions();
|
|
244
244
|
this._chart && this._chart.setOption(options);
|
|
245
245
|
},
|
|
246
|
-
}
|
|
246
|
+
},
|
|
247
247
|
});
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
<view
|
|
2
|
-
|
|
1
|
+
<view
|
|
2
|
+
wx:if="ec"
|
|
3
|
+
class="{{className}} ec_container"
|
|
4
|
+
style="{{style}}"
|
|
5
|
+
id="{{id}}"
|
|
6
|
+
>
|
|
7
|
+
<ec-canvas canvas-id="{{canvas_id}}" ec="{{ ec }}"></ec-canvas>
|
|
3
8
|
</view>
|
|
@@ -147,7 +147,7 @@ Component({
|
|
|
147
147
|
},
|
|
148
148
|
observers: {
|
|
149
149
|
// 当参数变化时
|
|
150
|
-
'**': async function() {
|
|
150
|
+
'**': async function () {
|
|
151
151
|
const objEChartPie = new EchartPie();
|
|
152
152
|
await objEChartPie.setOptions(this.properties);
|
|
153
153
|
const options = await objEChartPie.getOptions();
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
<view
|
|
2
|
-
|
|
1
|
+
<view
|
|
2
|
+
wx:if="ec"
|
|
3
|
+
class="{{className}} ec_container"
|
|
4
|
+
style="{{style}}"
|
|
5
|
+
id="{{id}}"
|
|
6
|
+
>
|
|
7
|
+
<ec-canvas canvas-id="{{canvas_id}}" ec="{{ ec }}"></ec-canvas>
|
|
3
8
|
</view>
|
|
4
|
-
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
<view
|
|
1
|
+
<view
|
|
2
|
+
class="weda-statistics-card weda-ui {{className}}"
|
|
3
|
+
style="{{style}}"
|
|
4
|
+
bind:tap="tap"
|
|
5
|
+
>
|
|
2
6
|
<view class="weda-statistics-card__wrapper">
|
|
3
7
|
<view class="weda-statistics-card__title">{{label}}</view>
|
|
4
8
|
<view class="weda-statistics-card__detail">
|
|
@@ -50,13 +50,13 @@ Component({
|
|
|
50
50
|
enumName: {
|
|
51
51
|
type: String,
|
|
52
52
|
value: '',
|
|
53
|
-
}
|
|
53
|
+
},
|
|
54
54
|
},
|
|
55
55
|
data: {
|
|
56
56
|
cls: '',
|
|
57
57
|
subCls: '',
|
|
58
58
|
isFlex: true,
|
|
59
|
-
defaultRange: []
|
|
59
|
+
defaultRange: [],
|
|
60
60
|
},
|
|
61
61
|
lifetimes: {
|
|
62
62
|
attached() {
|
|
@@ -81,14 +81,18 @@ Component({
|
|
|
81
81
|
_fetchData: async function () {
|
|
82
82
|
let data = await callWedaApi({
|
|
83
83
|
action: 'DescribeGeneralOptionsDetailList',
|
|
84
|
-
data: {
|
|
84
|
+
data: {
|
|
85
|
+
OptNameList: [this.properties.enumName],
|
|
86
|
+
PageIndex: 1,
|
|
87
|
+
PageSize: 10,
|
|
88
|
+
},
|
|
85
89
|
});
|
|
86
90
|
const config = destr(data?.Items?.[0]?.Config) ?? [];
|
|
87
|
-
const option = config.map(item => {
|
|
91
|
+
const option = config.map((item) => {
|
|
88
92
|
return {
|
|
89
93
|
label: item.value,
|
|
90
94
|
value: item.key,
|
|
91
|
-
checked: false
|
|
95
|
+
checked: false,
|
|
92
96
|
};
|
|
93
97
|
});
|
|
94
98
|
this.setData({ defaultRange: option });
|
|
@@ -111,6 +115,6 @@ Component({
|
|
|
111
115
|
if (format === 'x-enum' && this.properties.enumName) {
|
|
112
116
|
this._fetchData();
|
|
113
117
|
}
|
|
114
|
-
}
|
|
118
|
+
},
|
|
115
119
|
},
|
|
116
120
|
});
|
|
@@ -1,25 +1,28 @@
|
|
|
1
1
|
<formcell
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
className="{{cls}}"
|
|
3
|
+
style="{{style}}"
|
|
4
|
+
label="{{labelVisible ? label : null}}"
|
|
5
|
+
layout="{{layout}}"
|
|
6
|
+
multiCell="{{true}}"
|
|
7
|
+
requiredFlag="{{requiredFlag}}"
|
|
8
8
|
>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
</
|
|
9
|
+
<checkbox-group
|
|
10
|
+
class="{{isFlex ? 'weui-flex__item' : ''}}"
|
|
11
|
+
bindchange="change"
|
|
12
|
+
>
|
|
13
|
+
<label class="{{subCls}}" wx:for="{{defaultRange}}" wx:key="value">
|
|
14
|
+
<view class="weui-cell__hd">
|
|
15
|
+
<checkbox
|
|
16
|
+
class="weui-check"
|
|
17
|
+
value="{{item.value}}"
|
|
18
|
+
checked="{{item.checked}}"
|
|
19
|
+
disabled="{{disabled}}"
|
|
20
|
+
/>
|
|
21
|
+
<i class="weui-icon-checked" />
|
|
22
|
+
</view>
|
|
23
|
+
<view class="weui-cell__bd">
|
|
24
|
+
<view>{{item.label}}</view>
|
|
25
|
+
</view>
|
|
26
|
+
</label>
|
|
27
|
+
</checkbox-group>
|
|
28
|
+
</formcell>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<view class="weui-form weda-ui {{className}}" style="{{style}}">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
<view class="weui-cells__group weui-cells__group_form">
|
|
3
|
+
<slot name="contentSlot" />
|
|
4
|
+
</view>
|
|
5
5
|
</view>
|