Commit 741429eb3399d94c9c62e6918172e891a3cba142

Authored by xp.Huang
2 parents 5d480281 ca4620e4

Merge branch 'dev-fix-ww' into 'main_dev'

perf: 设备有别名显示别名

See merge request yunteng/thingskit-scada!62
@@ -4133,10 +4133,10 @@ App.prototype.loadFile = function (id, sameWindow, file, success, force) { @@ -4133,10 +4133,10 @@ App.prototype.loadFile = function (id, sameWindow, file, success, force) {
4133 <label style="margin-bottom: 10px; display: block;">访问令牌</label> 4133 <label style="margin-bottom: 10px; display: block;">访问令牌</label>
4134 <div class="layui-form-item" style="display: flex; justify-content: center; aligns-item: center;"> 4134 <div class="layui-form-item" style="display: flex; justify-content: center; aligns-item: center;">
4135 <div style="width: 70%"> 4135 <div style="width: 70%">
4136 - <input required lay-verify="required" type="text" name="${field}" lay-verify="title" autocomplete="off" placeholder="请输入访问令牌" class="layui-input"> 4136 + <input required lay-verify="required" type="password" name="${field}" lay-verify="title" autocomplete="off" placeholder="请输入访问令牌" class="layui-input">
4137 </div> 4137 </div>
4138 <button lay-submit lay-filter="${formSubmitFilter}" class="layui-btn layui-btn-normal" style="width: 30%;display: flex; justify-content: center; align-items: center;background-color: #1E9FFF;"> 4138 <button lay-submit lay-filter="${formSubmitFilter}" class="layui-btn layui-btn-normal" style="width: 30%;display: flex; justify-content: center; align-items: center;background-color: #1E9FFF;">
4139 - <svg t="1682068997810" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="79416" width="24" height="24"> 4139 + <svg style="transform: rotate(180deg);" t="1682068997810" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="79416" width="24" height="24">
4140 <path d="M512 928H128c-19.2 0-32-12.8-32-32V128c0-19.2 12.8-32 32-32h384c19.2 0 32 12.8 32 32s-12.8 32-32 32H160v704h352c19.2 0 32 12.8 32 32s-12.8 32-32 32z" fill="#fff" p-id="79417" /> 4140 <path d="M512 928H128c-19.2 0-32-12.8-32-32V128c0-19.2 12.8-32 32-32h384c19.2 0 32 12.8 32 32s-12.8 32-32 32H160v704h352c19.2 0 32 12.8 32 32s-12.8 32-32 32z" fill="#fff" p-id="79417" />
4141 <path d="M534.4 736c-9.6 0-16-3.2-22.4-9.6l-192-192c-12.8-12.8-12.8-32 0-44.8l192-192c12.8-12.8 32-12.8 44.8 0 12.8 12.8 12.8 32 0 44.8L387.2 512l169.6 169.6c12.8 12.8 12.8 32 0 44.8-6.4 6.4-16 9.6-22.4 9.6z" fill="#fff" p-id="79418"/> 4141 <path d="M534.4 736c-9.6 0-16-3.2-22.4-9.6l-192-192c-12.8-12.8-12.8-32 0-44.8l192-192c12.8-12.8 32-12.8 44.8 0 12.8 12.8 12.8 32 0 44.8L387.2 512l169.6 169.6c12.8 12.8 12.8 32 0 44.8-6.4 6.4-16 9.6-22.4 9.6z" fill="#fff" p-id="79418"/>
4142 <path d="M896 544H342.4c-19.2 0-32-12.8-32-32s12.8-32 32-32H896c19.2 0 32 12.8 32 32s-12.8 32-32 32z" fill="#fff" p-id="79419" /> 4142 <path d="M896 544H342.4c-19.2 0-32-12.8-32-32s12.8-32 32-32H896c19.2 0 32 12.8 32 32s-12.8 32-32 32z" fill="#fff" p-id="79419" />
@@ -6527,7 +6527,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { @@ -6527,7 +6527,7 @@ DataFormatPanel.prototype.addDataFont = function (container) {
6527 * @description 将设备选项挂载到节点中 6527 * @description 将设备选项挂载到节点中
6528 */ 6528 */
6529 function mountAllDeviceToSelect() { 6529 function mountAllDeviceToSelect() {
6530 - const generateOption = UseLayUi.generateOptionTemplate({ dataSource: allDeviceOptions }) 6530 + const generateOption = UseLayUi.generateOptionTemplate({ dataSource: allDeviceOptions, alias: 'alias' })
6531 $(`#${enumActionEl.DEVICE_DATA_BODY_EL}`).find(`select[name="${enumConst.DEVICE}"]`).html(generateOption) 6531 $(`#${enumActionEl.DEVICE_DATA_BODY_EL}`).find(`select[name="${enumConst.DEVICE}"]`).html(generateOption)
6532 UseLayUi.nextTick(() => form.render('select')) 6532 UseLayUi.nextTick(() => form.render('select'))
6533 } 6533 }
@@ -6635,7 +6635,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { @@ -6635,7 +6635,7 @@ DataFormatPanel.prototype.addDataFont = function (container) {
6635 function createAddRowListenEvent() { 6635 function createAddRowListenEvent() {
6636 $(`#${enumActionEl.ADD_ROW_EL}`).on('click', () => { 6636 $(`#${enumActionEl.ADD_ROW_EL}`).on('click', () => {
6637 addRecord() 6637 addRecord()
6638 - const generateOption = UseLayUi.generateOptionTemplate({ dataSource: allDeviceOptions }) 6638 + const generateOption = UseLayUi.generateOptionTemplate({ dataSource: allDeviceOptions, alias: 'alias' })
6639 $(`#${enumActionEl.DEVICE_DATA_BODY_EL} tr`).last().find(`select[name="${enumConst.DEVICE}"]`).html(generateOption) 6639 $(`#${enumActionEl.DEVICE_DATA_BODY_EL} tr`).last().find(`select[name="${enumConst.DEVICE}"]`).html(generateOption)
6640 form.render('select') 6640 form.render('select')
6641 }) 6641 })
@@ -6645,7 +6645,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { @@ -6645,7 +6645,7 @@ DataFormatPanel.prototype.addDataFont = function (container) {
6645 * @description 设置设备选项 6645 * @description 设置设备选项
6646 */ 6646 */
6647 function setDeviceOptions(row) { 6647 function setDeviceOptions(row) {
6648 - const generateOption = UseLayUi.generateOptionTemplate({ dataSource: allDeviceOptions }) 6648 + const generateOption = UseLayUi.generateOptionTemplate({ dataSource: allDeviceOptions, alias: 'alias' })
6649 $(`#${enumActionEl.DEVICE_DATA_BODY_EL} tr[lay-filter="${getRowFilter(row)}"]`).find(`select[name="${enumConst.DEVICE}"]`).html(generateOption) 6649 $(`#${enumActionEl.DEVICE_DATA_BODY_EL} tr[lay-filter="${getRowFilter(row)}"]`).find(`select[name="${enumConst.DEVICE}"]`).html(generateOption)
6650 } 6650 }
6651 6651
@@ -14925,7 +14925,7 @@ class HandleDataInteraction { @@ -14925,7 +14925,7 @@ class HandleDataInteraction {
14925 sendInstruction(list = []) { 14925 sendInstruction(list = []) {
14926 const queue = [] 14926 const queue = []
14927 const fn = async (way, deviceId, data) => { 14927 const fn = async (way, deviceId, data) => {
14928 - const [err, res = []] = await to(ConfigurationNodeApi.deviceIsOnLine(deviceId)) 14928 + const [err, res = []] = way === 'twoway' ? await to(ConfigurationNodeApi.deviceIsOnLine(deviceId)) : [null, [{ value: true }]]
14929 const { value } = res[0] || {} 14929 const { value } = res[0] || {}
14930 if (value) { 14930 if (value) {
14931 await to(ConfigurationNodeApi.sendInstruction(way, deviceId, data)) 14931 await to(ConfigurationNodeApi.sendInstruction(way, deviceId, data))
@@ -14947,15 +14947,6 @@ class HandleDataInteraction { @@ -14947,15 +14947,6 @@ class HandleDataInteraction {
14947 fn(way, deviceId, data) 14947 fn(way, deviceId, data)
14948 }) 14948 })
14949 } 14949 }
14950 - // if (slaveDeviceId) {  
14951 - // queue.push(() => {  
14952 - // fn(way, slaveDeviceId, data)  
14953 - // })  
14954 - // } else if (deviceId) {  
14955 - // queue.push(() => {  
14956 - // fn(way, deviceId, data)  
14957 - // })  
14958 - // }  
14959 } 14950 }
14960 14951
14961 Promise.all(queue.map(fn => fn())) 14952 Promise.all(queue.map(fn => fn()))