2017-03-24 33 views
4

我試圖修改類型服務任務下常規選項卡的詳細信息部分。對服務任務bpmn屬性面板下的委託條目的更改沒有得到更新在UI

我想要什麼?

我試圖實現,當用戶選擇實現類型爲JavaClass我顯示代理字段的下拉菜單,而不是其他任何其他選擇的文本框,而不是JavaClass它應該是文本框。

後來我想將動態數據加載到下拉列表中。

我試過了嗎?

我嘗試了以下2種方式

1:編輯後的文件camunda\parts\implementation\Delegate.js採取一個更VAR存儲entryFactory.selectBox和類型==類返回新創建的選擇框在module.exports否則返回默認文本框。

module.exports = function(element, bpmnFactory, options) { 

    var getImplementationType = options.getImplementationType, 
     getBusinessObject  = options.getBusinessObject; 

    var delegateEntrySelect = entryFactory.selectBox({ 
    id: 'delegate', 
    label: 'Value', 
    selectOptions: [ 
     {value:"one",name:"one"},{value:"two",name:"two"} 
    ], 
    modelProperty: 'delegate', 
    emptyParameter: false, 

    get: function(element, node) { 
     var bo = getBusinessObject(element); 
     var type = getImplementationType(element); 
     var attr = getAttribute(type); 
     var label = getDelegationLabel(type); 
     return { 
     delegate: bo.get(attr), 
     delegationLabel: label 
     }; 
    }, 

    set: function(element, values, node) { 
     var bo = getBusinessObject(element); 
     var prop = {}; 
     prop[attr] = values.delegate || ''; 
     return cmdHelper.updateBusinessObject(element, bo, prop); 
    }, 

    validate: function(element, values, node) { 
     return isDelegate(getImplementationType(element)) && !values.delegate ? { delegate: 'Must provide a value' } : {}; 
    } 
    }); 

    var delegateEntry = entryFactory.textField({ 
    id: 'delegate', 
    label: 'Value', 
    dataValueLabel: 'delegationLabel', 
    modelProperty: 'delegate', 

    get: function(element, node) { 
     var bo = getBusinessObject(element); 
     var type = getImplementationType(element); 
     var attr = getAttribute(type); 
     var label = getDelegationLabel(type); 
     return { 
     delegate: bo.get(attr), 
     delegationLabel: label 
     }; 
    }, 

    set: function(element, values, node) { 
     var bo = getBusinessObject(element); 
     var type = getImplementationType(element); 
     var attr = getAttribute(type); 
     var prop = {}; 
     prop[attr] = values.delegate || ''; 
     return cmdHelper.updateBusinessObject(element, bo, prop); 
    }, 

    validate: function(element, values, node) { 
     return isDelegate(getImplementationType(element)) && !values.delegate ? { delegate: 'Must provide a value' } : {}; 
    } 
    }); 

    var eleTOReturn = (getImplementationType(element) && getImplementationType(element) == "class") ? delegateEntrySelect : delegateEntry 
    console.log("returning ele",eleTOReturn) 
    return [ eleTOReturn ]; 
}; 

我得到的輸出是:

enter image description here

2:通過了這兩個選擇框和默認的文本框,但區分他們殘疾的條件,如 一:選擇框(isDelegate(getImplementationType (element))||(isDelegate(getImplementationType(element))& & type!==「class」))

b:textBox(!isDelegate(getImpleme ntationType(element))|| (isDelegate(getImplementationType(元件))& &類型===「類」))

在這兩種情況下的JS代碼執行良好,同樣可以下group.entries變量可以看出內camunda\parts\serviceTaskDelegateProps.js行#60,但他們不要反映在用戶界面上。

的Delegate.js代碼是根據

module.exports = function(element, bpmnFactory, options) { 

var getImplementationType = options.getImplementationType, 
    getBusinessObject  = options.getBusinessObject; 

var delegateEntrySelect = entryFactory.selectBox({ 
id: 'delegate', 
label: 'Value', 
selectOptions: [ 
    {value:"one",name:"one"},{value:"two",name:"two"} 
], 
modelProperty: 'delegate', 
emptyParameter: false, 

get: function(element, node) { 
    var bo = getBusinessObject(element); 
    var type = getImplementationType(element); 
    var attr = getAttribute(type); 
    var label = getDelegationLabel(type); 
    return { 
    delegate: bo.get(attr), 
    delegationLabel: label 
    }; 
}, 

set: function(element, values, node) { 
    var bo = getBusinessObject(element); 
    var prop = {}; 
    prop[attr] = values.delegate || ''; 
    return cmdHelper.updateBusinessObject(element, bo, prop); 
}, 

validate: function(element, values, node) { 
    return isDelegate(getImplementationType(element)) && !values.delegate ? { delegate: 'Must provide a value' } : {}; 
}, 

disabled: function(element, node) { 
    var type = getImplementationType(element); 
    console.log("SELECT DISABLE",(!isDelegate(getImplementationType(element)) || (isDelegate(getImplementationType(element)) && type !== "class"))) 
    return (!isDelegate(getImplementationType(element)) || (isDelegate(getImplementationType(element)) && type !== "class")); 
} 
}); 

var delegateEntry = entryFactory.textField({ 
id: 'delegate', 
label: 'Value', 
dataValueLabel: 'delegationLabel', 
modelProperty: 'delegate', 

get: function(element, node) { 
    var bo = getBusinessObject(element); 
    var type = getImplementationType(element); 
    var attr = getAttribute(type); 
    var label = getDelegationLabel(type); 
    return { 
    delegate: bo.get(attr), 
    delegationLabel: label 
    }; 
}, 

set: function(element, values, node) { 
    var bo = getBusinessObject(element); 
    var type = getImplementationType(element); 
    var attr = getAttribute(type); 
    var prop = {}; 
    prop[attr] = values.delegate || ''; 
    return cmdHelper.updateBusinessObject(element, bo, prop); 
}, 

validate: function(element, values, node) { 
    return isDelegate(getImplementationType(element)) && !values.delegate ? { delegate: 'Must provide a value' } : {}; 
}, 

disabled: function(element, node) { 
    var type = getImplementationType(element); 
    console.log("TEXT DISABLE",(!isDelegate(getImplementationType(element)) || (isDelegate(getImplementationType(element)) && type === "class"))) 
    return (!isDelegate(getImplementationType(element)) || (isDelegate(getImplementationType(element)) && type === "class")); 
} 
}); 

return [ delegateEntrySelect, delegateEntry ]; 
}; 

我得到的輸出是

enter image description here

有人可以請幫我在這裏。

由於

回答

1

通過添加對選擇框不同的文件作爲鄰近delegate.js然後在serviceTaskDelegateProps delegateSelect.js解決它。JS註冊它作爲

group.entries = group.entries.concat(delegateSelect(element, bpmnFactory, { 
    getBusinessObject: getBusinessObject, 
    getImplementationType: getImplementationType, 
    hideDelegateSelect: function(element, node) { 
     console.log(getImplementationType(element) !== 'class',"SELECT") 
     return getImplementationType(element) !== 'class'; 
    } 
    })); 

    group.entries = group.entries.concat(delegate(element, bpmnFactory, { 
    getBusinessObject: getBusinessObject, 
    getImplementationType: getImplementationType, 
    hideDelegateText: function(element, node) { 
     console.log(getImplementationType(element) === 'class',"TEXT") 
     return getImplementationType(element) === 'class'; 
    } 
    })); 

和在各自代表和delegateSelect處理的禁用作爲

disabled: function(element, node) { 
     if (typeof hideDelegateText === 'function') { 
     return hideDelegateText.apply(delegateEntry, arguments); 
     } 
    } 

disabled: function(element, node) { 
     if (typeof hideDelegateSelect === 'function') { 
     return hideDelegateSelect.apply(delegateEntrySelect, arguments); 
     } 
    } 

我稱爲的ResultVariable.js文件達到這一溶液

對於詳細視圖得​​ 由於