Commit 3f0e1d2f33e2cbf5be910e01506036d635282987

Authored by ww
1 parent 90b2080a

perf: 设备有别名显示别名

@@ -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()))