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 | 6025 | if (!orgId) return |
6026 | 6026 | const [err, res] = await to(ConfigurationNodeApi.getMasterDevice(orgId)) |
6027 | 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 | 6036 | $(`#${enumActionEl.DEVICE_DATA_BODY_EL}`).find(`select[name="${enumConst.DEVICE}"]`).html(generateOption) |
6030 | 6037 | UseLayUi.nextTick(() => form.render('select')) |
6031 | 6038 | } |
... | ... | @@ -6071,6 +6078,8 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
6071 | 6078 | }) |
6072 | 6079 | } |
6073 | 6080 | |
6081 | + | |
6082 | + | |
6074 | 6083 | /** |
6075 | 6084 | * @description 添加行 |
6076 | 6085 | * @param datum |
... | ... | @@ -6137,11 +6146,12 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
6137 | 6146 | }) |
6138 | 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 | 6150 | if (orgId && isGATEWAY && data.value) { |
6141 | 6151 | const [err, res] = await to(ConfigurationNodeApi.getSlaveDevice(orgId, data.value)) |
6142 | 6152 | if (!res) return |
6143 | 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 | 6156 | // else { |
6147 | 6157 | // updateVariableOptions(data) |
... | ... | @@ -6224,17 +6234,18 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
6224 | 6234 | * @description 回显表单数据 |
6225 | 6235 | */ |
6226 | 6236 | function echoFormData(info) { |
6227 | - const { content: { data = [] } = {}, orgId } = info | |
6228 | - echoOrgTree(orgId) | |
6237 | + const { content: { data = [] } = {} } = info | |
6229 | 6238 | data.forEach((datum, index) => echoEachData(datum, index)) |
6239 | + mountAllDeviceToSelect() | |
6230 | 6240 | } |
6231 | 6241 | |
6232 | 6242 | /** |
6233 | 6243 | * @description 回显组织树 |
6234 | 6244 | */ |
6235 | 6245 | function echoOrgTree(id) { |
6246 | + orgId = id | |
6236 | 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 | 6408 | }) |
6398 | 6409 | createOrgTreeSelect() |
6399 | 6410 | const info = getLayerBindInfo('event', type) |
6400 | - const { content: { data = [] } = {} } = info | |
6411 | + const { content: { data = [] } = {}, orgId } = info | |
6412 | + echoOrgTree(orgId) | |
6401 | 6413 | if (!info || !data.length) { |
6402 | 6414 | addRecord() |
6403 | 6415 | } else { | ... | ... |