diff --git a/src/iscs/iscs.js b/src/iscs/iscs.js
index 21b94f746..c590a1b82 100644
--- a/src/iscs/iscs.js
+++ b/src/iscs/iscs.js
@@ -33,8 +33,8 @@ class Iscs {
const height = opts.config.height;
this.isAllowDragging = false;
this.$iscsZr = zrender.init(opts.dom, Object.assign({ renderer, devicePixelRatio, width, height }, opts.config));
- this.$iscsZr.dom.setAttribute('tabIndex', -1);
- this.$options = new Options(Object.assign({ scaleRate: 1, offsetX: 0, offsetY: 0 }, opts.options || {})); // 缩放
+ this.$iscsZr.dom.setAttribute('tabIndex', -1);
+ this.$options = new Options(Object.assign({ scaleRate: 1, offsetX: 0, offsetY: 0 }, opts.options || {})); // 缩放
this.$mouseController = new MouseController(this);
this.$mouseController.enable();
diff --git a/src/iscs/shape/text.js b/src/iscs/shape/text.js
index 1969de132..6341ed541 100644
--- a/src/iscs/shape/text.js
+++ b/src/iscs/shape/text.js
@@ -18,6 +18,10 @@ export default class text extends Group {
id: model.code,
position: [model.point.x, model.point.y]
});
+ let text = model.context;
+ if (model.unit) {
+ text = model.context + model.unit;
+ }
this.textName = new Text({
zlevel: model.zlevel,
z: model.z,
@@ -28,7 +32,7 @@ export default class text extends Group {
fontWeight: model.fontWeight,
fontSize: model.fontSize,
fontFamily: 'consolas',
- text: model.context,
+ text: text,
textStrokeWidth: model.textStrokeWidth,
textFill: model.textFill,
textAlign: model.textAlign || 'center',
diff --git a/src/iscs/status/mapElement.js b/src/iscs/status/mapElement.js
index 1eca0bf7c..66e128dec 100644
--- a/src/iscs/status/mapElement.js
+++ b/src/iscs/status/mapElement.js
@@ -1,4 +1,5 @@
import elType from './elType';
+import iscs from '../iscs';
export default {
[elType.A.lab]: {
@@ -31,11 +32,46 @@ export default {
defval: 'stateA',
stateMap: {
stateA: {
- context: '8.3'
+ context: ''
},
stateB: {
- context: '7.6'
+ context: ''
}
}
} // 数组
};
+const arrNumA = [2.9, 8.1, 9.4, 1.8, 2.8, 9.4, 7.6, 6.8, 5.8, 9.8, 8.5];
+const arrNumV = [1657.0, 1558.3, 1768.8, 2486.3, 584.0];
+const arrNumKV = [45.8, 57.4, 67.1, 25.8, 34.8, 48.1];
+const arrNumKW = [113.5, 178.0, 254.6, 157.6, 135.7];
+const arrNumMVar = [0.254, 0.54, 0.971, 1.257];
+
+export function setNum(groupList) {
+ groupList.forEach(group => {
+ group.elemList.forEach(el => {
+ switch (el.type) {
+ case elType.C.lab:
+ switch (iscs.iscsDevice[el.code].unit) {
+ case 'A':
+ el.context = Math.floor(Math.random() * arrNumA.length + 1) - 1;
+ break;
+ case 'V':
+ el.context = Math.floor(Math.random() * arrNumV.length + 1) - 1;
+ break;
+ case 'KV':
+ el.context = Math.floor(Math.random() * arrNumKV.length + 1) - 1;
+ break;
+ case 'KW':
+ el.context = Math.floor(Math.random() * arrNumKW.length + 1) - 1;
+ break;
+ case 'MVar':
+ el.context = Math.floor(Math.random() * arrNumMVar.length + 1) - 1;
+ break;
+ }
+ break;
+ }
+ });
+ });
+
+ return groupList;
+}
diff --git a/src/views/iscs/iscsDraw/icscComponents/text.vue b/src/views/iscs/iscsDraw/icscComponents/text.vue
index 17fa17cbb..834576f80 100644
--- a/src/views/iscs/iscsDraw/icscComponents/text.vue
+++ b/src/views/iscs/iscsDraw/icscComponents/text.vue
@@ -4,6 +4,9 @@
+
+
+
@@ -58,6 +61,7 @@ export default {
form: {
code: '',
context: '',
+ unit: '',
textFill: '',
fontSize: 14,
fontWeight: 450,
@@ -108,6 +112,7 @@ export default {
this.isUpdate = true;
this.form.code = model.code;
this.form.context = model.context;
+ this.form.unit = model.unit || '';
this.form.fontSize = model.fontSize;
this.form.fontWeight = model.fontWeight;
this.form.textFill = model.textFill;
@@ -134,6 +139,7 @@ export default {
code: this.isUpdate ? this.form.code : getUID('IscsText', this.iscs.iscsTextList),
_type: 'IscsText',
context: this.form.context,
+ unit: this.form.unit,
textFill: this.form.textFill,
fontSize: this.form.fontSize,
fontWeight: this.form.fontWeight,
@@ -174,6 +180,7 @@ export default {
this.form = {
code: '',
context: '',
+ unit: '',
textFill: '',
fontSize: 14,
fontWeight: 450,