Commit 66cfc2682b23d419defcaa2230e9bb7c9d5821ca
1 parent
e2b7a950
fix: fix can not echo data source after group cell
Showing
2 changed files
with
23 additions
and
15 deletions
... | ... | @@ -195,8 +195,7 @@ LocalFile.prototype.saveFile = function (title, revision, success, error, useCur |
195 | 195 | this.removeDraft(); |
196 | 196 | Editor.defaultContent = savedData; |
197 | 197 | var configurationContentList = []; |
198 | - const basicAttr = Sidebar.prototype.enumCellBasicAttribute | |
199 | - const allCell = (this.ui.editor.graph.getDefaultParent().children || []).filter(item => item.getAttribute(basicAttr.COMPONENT_TYPE)) | |
198 | + const allCell = this.ui.editor.graph.getModel().cells || {} | |
200 | 199 | const contentId = this.ui.currentPage.node.id |
201 | 200 | var configurationContent = { |
202 | 201 | name: "第 1 页", |
... | ... | @@ -204,12 +203,12 @@ LocalFile.prototype.saveFile = function (title, revision, success, error, useCur |
204 | 203 | contentId, |
205 | 204 | content: savedData, |
206 | 205 | type: 1, |
207 | - nodeIds: allCell.map(item => item.id) | |
206 | + nodeIds: Object.keys(allCell) | |
208 | 207 | }; |
209 | 208 | configurationContentList.push(configurationContent); |
210 | 209 | var parmam = { configurationId: Editor.configurationId, configurationContentList }; |
211 | 210 | defHttp.put("/yt/configuration/content", parmam).then(res => { |
212 | - console.log(res) | |
211 | + // console.log(res) | |
213 | 212 | }) |
214 | 213 | } |
215 | 214 | catch (e) { | ... | ... |
... | ... | @@ -6164,6 +6164,11 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
6164 | 6164 | */ |
6165 | 6165 | let orgId = null |
6166 | 6166 | |
6167 | + const recordData = { | |
6168 | + orgId: null, | |
6169 | + enabled: false | |
6170 | + } | |
6171 | + | |
6167 | 6172 | const getRowFilter = (rowNumber) => `${enumActionEl.ROW_FILTER}${rowNumber}` |
6168 | 6173 | |
6169 | 6174 | /** |
... | ... | @@ -6208,8 +6213,8 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
6208 | 6213 | * @description 创建回显数据 查询出所有网关设备和直连设备 |
6209 | 6214 | */ |
6210 | 6215 | async function getAllGatewayDeviceAndConnectionDevice() { |
6211 | - if (!orgId) return | |
6212 | - const [err, res] = await to(ConfigurationNodeApi.getAllGatewayDeviceAndConnectionDevice(orgId)) | |
6216 | + if (!recordData.orgId) return | |
6217 | + const [err, res] = await to(ConfigurationNodeApi.getAllGatewayDeviceAndConnectionDevice(recordData.orgId)) | |
6213 | 6218 | allDeviceOptions = res |
6214 | 6219 | mountAllDeviceToSelect() |
6215 | 6220 | } |
... | ... | @@ -6259,7 +6264,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
6259 | 6264 | data: treeList, |
6260 | 6265 | onlyIconControl: true, |
6261 | 6266 | click(node) { |
6262 | - orgId = node.data.id | |
6267 | + recordData.orgId = node.data.id | |
6263 | 6268 | getAllGatewayDeviceAndConnectionDevice() |
6264 | 6269 | }, |
6265 | 6270 | }, |
... | ... | @@ -6369,7 +6374,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
6369 | 6374 | * @description 回显表单数据 |
6370 | 6375 | */ |
6371 | 6376 | function echoFormData(info) { |
6372 | - const { content: { data = [] } = {}, orgId } = info | |
6377 | + const { content: { data = [] } = {} } = info | |
6373 | 6378 | data.forEach((datum, index) => { |
6374 | 6379 | addRecord(datum) |
6375 | 6380 | form.val(getRowFilter(index), datum) |
... | ... | @@ -6380,9 +6385,9 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
6380 | 6385 | * @description 回显组织树 |
6381 | 6386 | */ |
6382 | 6387 | function echoOrgTree(id) { |
6383 | - orgId = id | |
6388 | + recordData.orgId = id | |
6384 | 6389 | const node = UseLayUi.findTreeObjectByField(treeList, id) |
6385 | - UseLayUi.nextTick(() => $(`#${enumActionEl.ORG_EL} input[name="${enumConst.ORG_ID}"]`).val(orgId).parent().find('span').html(node?.name)) | |
6390 | + UseLayUi.nextTick(() => $(`#${enumActionEl.ORG_EL} input[name="${enumConst.ORG_ID}"]`).val(recordData.orgId).parent().find('span').html(node?.name)) | |
6386 | 6391 | } |
6387 | 6392 | |
6388 | 6393 | /** |
... | ... | @@ -6426,6 +6431,8 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
6426 | 6431 | return validateFlag |
6427 | 6432 | } |
6428 | 6433 | |
6434 | + | |
6435 | + | |
6429 | 6436 | /** |
6430 | 6437 | * @description 保存 |
6431 | 6438 | */ |
... | ... | @@ -6433,8 +6440,9 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
6433 | 6440 | const data = Array.from({ length: addRowNumber }).map((_, row) => form.val(getRowFilter(row))).filter(item => Object.keys(item).length) |
6434 | 6441 | if (!validate(data)) return |
6435 | 6442 | const formModal = { |
6443 | + ...recordData, | |
6436 | 6444 | configurationId, |
6437 | - orgId, | |
6445 | + // orgId, | |
6438 | 6446 | contentId: currentPageId.id, |
6439 | 6447 | id: graphId, |
6440 | 6448 | content: { |
... | ... | @@ -6525,8 +6533,8 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
6525 | 6533 | }) |
6526 | 6534 | createOrgTreeSelect() |
6527 | 6535 | const info = getLayerBindInfo('event', type) |
6528 | - const { content: { data = [] } = {}, orgId: recordOrgId } = info | |
6529 | - orgId = recordOrgId | |
6536 | + const { content: { data = [] } = {}, orgId, enabled } = info | |
6537 | + Object.assign(recordData, { orgId, enabled }) | |
6530 | 6538 | await getAllGatewayDeviceAndConnectionDevice() |
6531 | 6539 | if (!info || !data.length) { |
6532 | 6540 | addRecord() |
... | ... | @@ -6535,7 +6543,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
6535 | 6543 | } |
6536 | 6544 | generatorEventListen() |
6537 | 6545 | form.render() |
6538 | - echoOrgTree(recordOrgId) | |
6546 | + echoOrgTree(orgId) | |
6539 | 6547 | }, |
6540 | 6548 | }) |
6541 | 6549 | } |
... | ... | @@ -11570,7 +11578,7 @@ class UseLayUi { |
11570 | 11578 | static createTreeSelect(options) { |
11571 | 11579 | const CLASS_NAME = 'things-kit-tree-select' |
11572 | 11580 | const SELECT_CLS = 'things-kit-tree-select__tree' |
11573 | - const { tree, jquery: $ } = layui | |
11581 | + const { tree, jquery: $, form } = layui | |
11574 | 11582 | |
11575 | 11583 | const { |
11576 | 11584 | layFilter, |
... | ... | @@ -11670,6 +11678,7 @@ class UseLayUi { |
11670 | 11678 | onReady(setValue) |
11671 | 11679 | } |
11672 | 11680 | }) |
11681 | + form.render() | |
11673 | 11682 | } |
11674 | 11683 | |
11675 | 11684 | mount() | ... | ... |