Commit 7c9ec22a47a94eddf7fee17572e3659195dd1009
1 parent
2618f8ee
fix: fix bind event submit params has some problem
Showing
1 changed file
with
18 additions
and
6 deletions
@@ -6025,7 +6025,14 @@ DataFormatPanel.prototype.addDataFont = function (container) { | @@ -6025,7 +6025,14 @@ DataFormatPanel.prototype.addDataFont = function (container) { | ||
6025 | if (!orgId) return | 6025 | if (!orgId) return |
6026 | const [err, res] = await to(ConfigurationNodeApi.getMasterDevice(orgId)) | 6026 | const [err, res] = await to(ConfigurationNodeApi.getMasterDevice(orgId)) |
6027 | allDeviceOptions = res | 6027 | allDeviceOptions = res |
6028 | - const generateOption = UseLayUi.generateOptionTemplate({ dataSource: res }) | 6028 | + mountAllDeviceToSelect() |
6029 | + } | ||
6030 | + | ||
6031 | + /** | ||
6032 | + * @description 将设备选项挂载到节点中 | ||
6033 | + */ | ||
6034 | + function mountAllDeviceToSelect() { | ||
6035 | + const generateOption = UseLayUi.generateOptionTemplate({ dataSource: allDeviceOptions }) | ||
6029 | $(`#${enumActionEl.DEVICE_DATA_BODY_EL}`).find(`select[name="${enumConst.DEVICE}"]`).html(generateOption) | 6036 | $(`#${enumActionEl.DEVICE_DATA_BODY_EL}`).find(`select[name="${enumConst.DEVICE}"]`).html(generateOption) |
6030 | UseLayUi.nextTick(() => form.render('select')) | 6037 | UseLayUi.nextTick(() => form.render('select')) |
6031 | } | 6038 | } |
@@ -6071,6 +6078,8 @@ DataFormatPanel.prototype.addDataFont = function (container) { | @@ -6071,6 +6078,8 @@ DataFormatPanel.prototype.addDataFont = function (container) { | ||
6071 | }) | 6078 | }) |
6072 | } | 6079 | } |
6073 | 6080 | ||
6081 | + | ||
6082 | + | ||
6074 | /** | 6083 | /** |
6075 | * @description 添加行 | 6084 | * @description 添加行 |
6076 | * @param datum | 6085 | * @param datum |
@@ -6137,11 +6146,12 @@ DataFormatPanel.prototype.addDataFont = function (container) { | @@ -6137,11 +6146,12 @@ DataFormatPanel.prototype.addDataFont = function (container) { | ||
6137 | }) | 6146 | }) |
6138 | const isGATEWAY = allDeviceOptions.find(item => item.id === data.value)?.deviceType === "GATEWAY" | 6147 | const isGATEWAY = allDeviceOptions.find(item => item.id === data.value)?.deviceType === "GATEWAY" |
6139 | // 网关设备请求子设备 | 6148 | // 网关设备请求子设备 |
6149 | + $(data.elem).parents('tr').find(`select[name="${enumConst.SLAVE_DEVICE}"]`).attr('lay-verify', '') | ||
6140 | if (orgId && isGATEWAY && data.value) { | 6150 | if (orgId && isGATEWAY && data.value) { |
6141 | const [err, res] = await to(ConfigurationNodeApi.getSlaveDevice(orgId, data.value)) | 6151 | const [err, res] = await to(ConfigurationNodeApi.getSlaveDevice(orgId, data.value)) |
6142 | if (!res) return | 6152 | if (!res) return |
6143 | const generateOption = UseLayUi.generateOptionTemplate({ dataSource: res }) | 6153 | const generateOption = UseLayUi.generateOptionTemplate({ dataSource: res }) |
6144 | - $(data.elem).parents('tr').find(`select[name="${enumConst.SLAVE_DEVICE}"]`).html(generateOption) | 6154 | + $(data.elem).parents('tr').find(`select[name="${enumConst.SLAVE_DEVICE}"]`).attr('lay-verify', 'required').html(generateOption) |
6145 | } | 6155 | } |
6146 | // else { | 6156 | // else { |
6147 | // updateVariableOptions(data) | 6157 | // updateVariableOptions(data) |
@@ -6224,17 +6234,18 @@ DataFormatPanel.prototype.addDataFont = function (container) { | @@ -6224,17 +6234,18 @@ DataFormatPanel.prototype.addDataFont = function (container) { | ||
6224 | * @description 回显表单数据 | 6234 | * @description 回显表单数据 |
6225 | */ | 6235 | */ |
6226 | function echoFormData(info) { | 6236 | function echoFormData(info) { |
6227 | - const { content: { data = [] } = {}, orgId } = info | ||
6228 | - echoOrgTree(orgId) | 6237 | + const { content: { data = [] } = {} } = info |
6229 | data.forEach((datum, index) => echoEachData(datum, index)) | 6238 | data.forEach((datum, index) => echoEachData(datum, index)) |
6239 | + mountAllDeviceToSelect() | ||
6230 | } | 6240 | } |
6231 | 6241 | ||
6232 | /** | 6242 | /** |
6233 | * @description 回显组织树 | 6243 | * @description 回显组织树 |
6234 | */ | 6244 | */ |
6235 | function echoOrgTree(id) { | 6245 | function echoOrgTree(id) { |
6246 | + orgId = id | ||
6236 | const node = UseLayUi.findTreeObjectByField(treeList, id) | 6247 | const node = UseLayUi.findTreeObjectByField(treeList, id) |
6237 | - $(`#${enumActionEl.ORG_EL}`).find(`input[name="${enumConst.ORG_ID}"]`).parent().find('span').html(node?.name) | 6248 | + $(`#${enumActionEl.ORG_EL}`).find(`input[name="${enumConst.ORG_ID}"]`).val(orgId).parent().find('span').html(node?.name) |
6238 | } | 6249 | } |
6239 | 6250 | ||
6240 | /** | 6251 | /** |
@@ -6397,7 +6408,8 @@ DataFormatPanel.prototype.addDataFont = function (container) { | @@ -6397,7 +6408,8 @@ DataFormatPanel.prototype.addDataFont = function (container) { | ||
6397 | }) | 6408 | }) |
6398 | createOrgTreeSelect() | 6409 | createOrgTreeSelect() |
6399 | const info = getLayerBindInfo('event', type) | 6410 | const info = getLayerBindInfo('event', type) |
6400 | - const { content: { data = [] } = {} } = info | 6411 | + const { content: { data = [] } = {}, orgId } = info |
6412 | + echoOrgTree(orgId) | ||
6401 | if (!info || !data.length) { | 6413 | if (!info || !data.length) { |
6402 | addRecord() | 6414 | addRecord() |
6403 | } else { | 6415 | } else { |