Commit ff27dfceccd351843c130d2a982027ab2b160c3b

Authored by ww
1 parent 50b90be9

fix: 控制组件调用服务时携带标识符

... ... @@ -7532,7 +7532,12 @@ DataFormatPanel.prototype.addDataFont = function (container) {
7532 7532 */
7533 7533 ATTR_PLACEHOLDER: 'attrPlaceholder',
7534 7534
7535   - WAY: 'way'
  7535 + WAY: 'way',
  7536 +
  7537 + /**
  7538 + * @description 标识符号
  7539 + */
  7540 + IDENTIFIER: 'identifier'
7536 7541 }
7537 7542
7538 7543 /**
... ... @@ -7651,6 +7656,7 @@ DataFormatPanel.prototype.addDataFont = function (container) {
7651 7656 [enumGetValue[content.type]]: content.value,
7652 7657
7653 7658 // 参数设置
  7659 + [enumConst.IDENTIFIER]: content[enumConst.IDENTIFIER],
7654 7660 [enumConst.JSON_COMMAND]: content[enumConst.JSON_COMMAND],
7655 7661 [enumConst.WAY]: content[enumConst.WAY] || enumWayType.ONE_WAY,
7656 7662 [enumConst.COMMAND_TYPE]: content[enumConst.COMMAND_TYPE],
... ... @@ -7781,6 +7787,7 @@ DataFormatPanel.prototype.addDataFont = function (container) {
7781 7787 type: formVal[enumConst.ACTION],
7782 7788 value: formVal[enumGetValue[formVal[enumConst.ACTION]]],
7783 7789 ...(isParamsSetting ? {
  7790 + [enumConst.IDENTIFIER]: formVal[enumConst.IDENTIFIER],
7784 7791 [enumConst.JSON_COMMAND]: formVal[enumConst.JSON_COMMAND],
7785 7792 [enumConst.WAY]: formVal[enumConst.WAY],
7786 7793 [enumConst.COMMAND_TYPE]: formVal[enumConst.COMMAND_TYPE],
... ... @@ -7867,7 +7874,7 @@ DataFormatPanel.prototype.addDataFont = function (container) {
7867 7874 $(`#${enumActionEl.SERVICE_EL}`).css({ display: flag ? 'none' : 'block' })
7868 7875 $(`#${enumActionEl.TCP_COMMAND_INPUT}`).css({ display: isTCPTransportType && flag ? 'block' : 'none' })
7869 7876 $(`#${enumActionEl.EDITOR_CONTAINER}`).css({ display: !isTCPTransportType && flag ? 'flex' : 'none' })
7870   - form.val(enumActionEl.FORM_FILTER, { [enumConst.TCP_COMMAND]: '', [enumConst.SERVICE]: '', [enumConst.COMMAND]: '' })
  7877 + form.val(enumActionEl.FORM_FILTER, { [enumConst.TCP_COMMAND]: '', [enumConst.SERVICE]: '', [enumConst.COMMAND]: '', [enumConst.IDENTIFIER]: '' })
7871 7878 $(`#${enumActionEl.INPUT_DATA_FORM}`).html('')
7872 7879 editorAssignValue()
7873 7880 })
... ... @@ -7886,7 +7893,7 @@ DataFormatPanel.prototype.addDataFont = function (container) {
7886 7893 } else {
7887 7894 form.val(enumActionEl.FORM_FILTER, { [enumConst.SERVICE_COMMAND]: needRender.functionJson?.inputData?.[0]?.serviceCommand || '' })
7888 7895 }
7889   - form.val(enumActionEl.FORM_FILTER, { [enumConst.SERVICE_ORIGINAL_CONFIGURATION]: JSON.stringify(needRender.functionJson?.inputData || []) })
  7896 + form.val(enumActionEl.FORM_FILTER, { [enumConst.SERVICE_ORIGINAL_CONFIGURATION]: JSON.stringify(needRender.functionJson?.inputData || []), [enumConst.IDENTIFIER]: needRender?.identifier })
7890 7897 })
7891 7898
7892 7899 try {
... ... @@ -8026,6 +8033,9 @@ DataFormatPanel.prototype.addDataFont = function (container) {
8026 8033 </div>
8027 8034 </div>
8028 8035 <div style="display: none;">
  8036 + <input type="text" name="${enumConst.IDENTIFIER}" placeholder="标识符" />
  8037 + </div>
  8038 + <div style="display: none;">
8029 8039 <input type="text" name="${enumConst.SERVICE_COMMAND}" placeholder="服务命令" />
8030 8040 </div>
8031 8041 <div style="display: none;">
... ... @@ -15896,7 +15906,7 @@ class HandleDataInteraction {
15896 15906
15897 15907 let flag = false
15898 15908 let value
15899   -
  15909 +
15900 15910 if (isCustom) {
15901 15911 if (isTCP) {
15902 15912 value = content.tcpCommand
... ... @@ -15911,6 +15921,7 @@ class HandleDataInteraction {
15911 15921 if (isTCP) {
15912 15922 value = content.serviceCommand
15913 15923 if (value) flag = true
  15924 + else UseLayUi.topErrorMsg('服务命令为空')
15914 15925 } else {
15915 15926 value = content.serviceCommand
15916 15927 const { flag: validateFlag, value: validateValue } = UseLayUi.validateThingsModelInputDataForm(Utils.stringToJSON(content.serviceOriginalConfiguration), value, true)
... ... @@ -16022,12 +16033,17 @@ class HandleDataInteraction {
16022 16033 * @type {command: string , commandType: string, service: string, wary: string, tcpCommand: string}
16023 16034 */
16024 16035 let { command, way, tcpCommand } = content
16025   -
  16036 + const identifier = content?.identifier
  16037 + const params = content?.transportType === 'TCP'
  16038 + ? value
  16039 + : identifier
  16040 + ? { [identifier]: value }
  16041 + : value
16026 16042 const instructionData = {
16027 16043 method: "methodThingskit",
16028 16044 additionalInfo: { cmdType: 'API' },
16029 16045 persistent: true,
16030   - params: value,
  16046 + params,
16031 16047 }
16032 16048
16033 16049 const [err, res = []] = way === 'twoway' ? await to(ConfigurationNodeApi.deviceIsOnLine(deviceId)) : [null, [{ value: true }]]
... ...