node-red-contrib-mitsubishi 1.0.3 → 1.1.0

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.
@@ -12,6 +12,26 @@
12
12
  <input type="number" id="node-input-serialNo" value="0" min="0" max="65535" style="width:100px">
13
13
  </div>
14
14
 
15
+ <!-- 批量生成 -->
16
+ <div class="form-row" style="margin-top:8px">
17
+ <label><i class="fa fa-bolt"></i> 批量添加</label>
18
+ </div>
19
+ <div style="margin-bottom:6px;display:flex;gap:4px;align-items:center;flex-wrap:wrap">
20
+ <span style="font-size:11px">起始</span>
21
+ <input id="batch-start" type="number" value="0" min="0" style="width:60px;font-size:11px" placeholder="0">
22
+ <span style="font-size:11px">数量</span>
23
+ <input id="batch-count" type="number" value="1" min="1" max="500" style="width:55px;font-size:11px" placeholder="1">
24
+ <select id="batch-reg" style="width:55px;font-size:11px">
25
+ <option>D</option><option>W</option><option>R</option><option>X</option><option>Y</option><option>M</option><option>L</option><option>B</option>
26
+ </select>
27
+ <select id="batch-dt" style="width:75px;font-size:11px">
28
+ <option>INT16</option><option>UINT16</option><option>INT32</option><option>UINT32</option><option>FLOAT32</option><option>BOOL</option>
29
+ </select>
30
+ <button class="red-ui-button" onclick="addTagBatch()" style="font-size:11px;padding:2px 8px">
31
+ <i class="fa fa-bolt"></i> 生成
32
+ </button>
33
+ </div>
34
+
15
35
  <!-- 点位编辑表格 -->
16
36
  <div class="form-row" style="margin-top:8px">
17
37
  <label><i class="fa fa-list"></i> 默认点位 (msg.tags 传入时覆盖)</label>
@@ -144,6 +164,20 @@
144
164
  oneditprepare: function () {
145
165
  tagEditor.init();
146
166
  window.addTagRow = function () { tagEditor.add(); };
167
+ window.addTagBatch = function () {
168
+ var start = parseInt($('#batch-start').val(), 10) || 0;
169
+ var count = parseInt($('#batch-count').val(), 10) || 1;
170
+ var reg = $('#batch-reg').val() || 'D';
171
+ var dt = $('#batch-dt').val() || 'INT16';
172
+ for (var i = 0; i < count; i++) {
173
+ tagEditor.rows.push({
174
+ id: '', regType: reg, addr: String(start + i),
175
+ dataType: dt, slope: '1', offset: '0', name: reg + (start + i)
176
+ });
177
+ }
178
+ tagEditor.render();
179
+ tagEditor.save();
180
+ };
147
181
  },
148
182
  oneditsave: function () {
149
183
  delete window.addTagRow;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-mitsubishi",
3
- "version": "1.0.3",
3
+ "version": "1.1.0",
4
4
  "description": "三菱 MC Protocol 3E/4E 采集节点 — 纯TCP零依赖, 支持Q/L/iQ-R/iQ-F/FX5U",
5
5
  "main": "nodes/mitsubishi-read.js",
6
6
  "node-red": {