Commit e3fb8dbbbb13fcaa57d5ac74a3f837412e25cf8f

Authored by ww
1 parent 71c0bb93

fix: fix interaction event layer org tree can not echo data

@@ -6408,7 +6408,9 @@ DataFormatPanel.prototype.addDataFont = function (container) { @@ -6408,7 +6408,9 @@ DataFormatPanel.prototype.addDataFont = function (container) {
6408 function echoOrgTree(id) { 6408 function echoOrgTree(id) {
6409 recordData.orgId = id 6409 recordData.orgId = id
6410 const node = UseLayUi.findTreeObjectByField(treeList, id) 6410 const node = UseLayUi.findTreeObjectByField(treeList, id)
6411 - UseLayUi.nextTick(() => $(`#${enumActionEl.ORG_EL} input[name="${enumConst.ORG_ID}"]`).val(recordData.orgId).parent().find('span').html(node?.name)) 6411 + UseLayUi.nextTick(() => {
  6412 + $(`#${enumActionEl.ORG_EL} input[name="${enumConst.ORG_ID}"]`).val(recordData.orgId).parent().find('span').html(node?.name)
  6413 + })
6412 } 6414 }
6413 6415
6414 /** 6416 /**
@@ -6552,7 +6554,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { @@ -6552,7 +6554,7 @@ DataFormatPanel.prototype.addDataFont = function (container) {
6552 'lay-submit': '', 6554 'lay-submit': '',
6553 'lay-filter': enumActionEl.LAYER_SUBMIT_FILTER, 6555 'lay-filter': enumActionEl.LAYER_SUBMIT_FILTER,
6554 }) 6556 })
6555 - createOrgTreeSelect() 6557 + await createOrgTreeSelect()
6556 const info = getLayerBindInfo('event', type) 6558 const info = getLayerBindInfo('event', type)
6557 const { content: { data = [] } = {}, orgId, enabled } = info 6559 const { content: { data = [] } = {}, orgId, enabled } = info
6558 Object.assign(recordData, { orgId, enabled }) 6560 Object.assign(recordData, { orgId, enabled })
@@ -11673,47 +11675,47 @@ class UseLayUi { @@ -11673,47 +11675,47 @@ class UseLayUi {
11673 $(elem).html(template) 11675 $(elem).html(template)
11674 11676
11675 // mount tree 11677 // mount tree
11676 - UseLayUi.nextTick(() => {  
11677 - tree.render({  
11678 - ...treeProps,  
11679 - ...(autoFormatDataSource ? { data: UseLayUi.formatTreeDataSource(data, customSetTree, valueField, labelField, childrenField) } : {}),  
11680 - elem: $(elem).find('.tree-select__tree-mount'),  
11681 - click(node) {  
11682 - setValue(node.data)  
11683 - if (UseLayUi.isFunction(click)) click(node)  
11684 - },  
11685 - }) 11678 + // UseLayUi.nextTick(() => {
  11679 + tree.render({
  11680 + ...treeProps,
  11681 + ...(autoFormatDataSource ? { data: UseLayUi.formatTreeDataSource(data, customSetTree, valueField, labelField, childrenField) } : {}),
  11682 + elem: $(elem).find('.tree-select__tree-mount'),
  11683 + click(node) {
  11684 + setValue(node.data)
  11685 + if (UseLayUi.isFunction(click)) click(node)
  11686 + },
  11687 + })
11686 11688
11687 - // focus  
11688 - $(`.${SELECT_CLS}`).off('click')  
11689 - .on("click", ".layui-select-title", function (e) {  
11690 - $(document).find('.layui-form-select').removeClass('layui-form-selected')  
11691 - $(this).parents(`.${SELECT_CLS}`).toggleClass("layui-form-selected");  
11692 - layui.stope(e);  
11693 - })  
11694 - .on('click', '.layui-anim', (e) => {  
11695 - layui.stope(e)  
11696 - })  
11697 - .on("click", "dl i", function (e) {  
11698 - layui.stope(e);  
11699 - }) 11689 + // focus
  11690 + $(`.${SELECT_CLS}`).off('click')
  11691 + .on("click", ".layui-select-title", function (e) {
  11692 + $(document).find('.layui-form-select').removeClass('layui-form-selected')
  11693 + $(this).parents(`.${SELECT_CLS}`).toggleClass("layui-form-selected");
  11694 + layui.stope(e);
  11695 + })
  11696 + .on('click', '.layui-anim', (e) => {
  11697 + layui.stope(e)
  11698 + })
  11699 + .on("click", "dl i", function (e) {
  11700 + layui.stope(e);
  11701 + })
11700 11702
11701 - // blur  
11702 - // $(document)  
11703 - // .on("click", function (e) {  
11704 - // const target = e.target  
11705 - // const parentNode = $(`.${CLASS_NAME} .tree-select__tree-mount`)  
11706 - // if (!parentNode) return  
11707 - // console.log($.contains(parentNode, target))  
11708 - // // const showClose = UseLayUi.isInNode(parentNode, target, true)  
11709 - // // if (showClose) return  
11710 - // // $(`.${ SELECT_CLS }`).removeClass("layui-form-selected")  
11711 - // });  
11712 -  
11713 - if (UseLayUi.isFunction(onReady)) {  
11714 - onReady(setValue)  
11715 - }  
11716 - }) 11703 + // blur
  11704 + // $(document)
  11705 + // .on("click", function (e) {
  11706 + // const target = e.target
  11707 + // const parentNode = $(`.${CLASS_NAME} .tree-select__tree-mount`)
  11708 + // if (!parentNode) return
  11709 + // console.log($.contains(parentNode, target))
  11710 + // // const showClose = UseLayUi.isInNode(parentNode, target, true)
  11711 + // // if (showClose) return
  11712 + // // $(`.${ SELECT_CLS }`).removeClass("layui-form-selected")
  11713 + // });
  11714 +
  11715 + if (UseLayUi.isFunction(onReady)) {
  11716 + onReady(setValue)
  11717 + }
  11718 + // })
11717 form.render() 11719 form.render()
11718 } 11720 }
11719 11721
@@ -11756,13 +11758,13 @@ class UseLayUi { @@ -11756,13 +11758,13 @@ class UseLayUi {
11756 } 11758 }
11757 11759
11758 let template = ` 11760 let template = `
11759 - <div class="layui-form-item ${CLASS_NAME}" >  
11760 - <label class="layui-form-label">${label}</label>  
11761 - <div class="layui-input-block">  
11762 - ${createOptions(dataSource).join('')}  
11763 - </div>  
11764 - </div>  
11765 - ` 11761 + <div class="layui-form-item ${CLASS_NAME}" >
  11762 + <label class="layui-form-label">${label}</label>
  11763 + <div class="layui-input-block">
  11764 + ${createOptions(dataSource).join('')}
  11765 + </div>
  11766 + </div>`
  11767 +
11766 template = singleUsage ? UseLayUi.createSingleUseFormItem(template) : template 11768 template = singleUsage ? UseLayUi.createSingleUseFormItem(template) : template
11767 11769
11768 function mount() { 11770 function mount() {