Commit 66cfc2682b23d419defcaa2230e9bb7c9d5821ca

Authored by ww
1 parent e2b7a950

fix: fix can not echo data source after group cell

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