|
|
@ -2,7 +2,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
// 给多层级单选树增加设置错误值时标红状态
|
|
|
|
// 给多层级单选树增加设置错误值时标红状态
|
|
|
|
BI.config("bi.multilayer_single_tree_combo", function (config) { |
|
|
|
BI.config("bi.multilayer_single_tree_combo", function (config) { |
|
|
|
var ERROR_CLASS = 'combo-error'; |
|
|
|
var ERROR_CLASS = "combo-error"; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 判断是否是有效值 |
|
|
|
* 判断是否是有效值 |
|
|
@ -11,10 +11,12 @@ |
|
|
|
* @returns {Boolean} |
|
|
|
* @returns {Boolean} |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function isValueValid (options, value) { |
|
|
|
function isValueValid (options, value) { |
|
|
|
value = value || options.value || ''; |
|
|
|
value = value || options.value; |
|
|
|
if (Array.isArray(value)) { |
|
|
|
if (Array.isArray(value)) { |
|
|
|
value = value[0]; |
|
|
|
value = value[0]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
value = value || null; |
|
|
|
|
|
|
|
|
|
|
|
var items = options.items || []; |
|
|
|
var items = options.items || []; |
|
|
|
var itemIds = []; |
|
|
|
var itemIds = []; |
|
|
|
|
|
|
|
|
|
|
@ -29,9 +31,9 @@ |
|
|
|
|
|
|
|
|
|
|
|
if (BI.contains(itemIds, value)) { |
|
|
|
if (BI.contains(itemIds, value)) { |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} else { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -107,7 +109,7 @@ |
|
|
|
return BI.Models.getModel("dec.amiba.test.tree.model"); |
|
|
|
return BI.Models.getModel("dec.amiba.test.tree.model"); |
|
|
|
}, |
|
|
|
}, |
|
|
|
props: { |
|
|
|
props: { |
|
|
|
baseCls: 'fine-test-tree', |
|
|
|
baseCls: "fine-test-tree" |
|
|
|
}, |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
watch: { |
|
|
|
items: function (items) { |
|
|
|
items: function (items) { |
|
|
@ -137,17 +139,17 @@ |
|
|
|
|
|
|
|
|
|
|
|
// 测试修改value
|
|
|
|
// 测试修改value
|
|
|
|
setTimeout(function () { |
|
|
|
setTimeout(function () { |
|
|
|
console.log('setValue'); |
|
|
|
console.log("setValue"); |
|
|
|
self.treeRef.setValue('不存在的值'); |
|
|
|
self.treeRef.setValue(""); |
|
|
|
}, 3000); |
|
|
|
}, 3000); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
items: [ |
|
|
|
items: [ |
|
|
|
{ |
|
|
|
{ |
|
|
|
type: 'bi.label', |
|
|
|
type: "bi.label", |
|
|
|
textAlign: 'left', |
|
|
|
textAlign: "left", |
|
|
|
text: '叶子节点单选' |
|
|
|
text: "叶子节点单选" |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
type: "bi.multilayer_single_tree_combo", |
|
|
|
type: "bi.multilayer_single_tree_combo", |
|
|
@ -160,7 +162,7 @@ |
|
|
|
width: 250, |
|
|
|
width: 250, |
|
|
|
value: self.model.value, |
|
|
|
value: self.model.value, |
|
|
|
listeners: [{ |
|
|
|
listeners: [{ |
|
|
|
eventName: 'EVENT_CHANGE', |
|
|
|
eventName: "EVENT_CHANGE", |
|
|
|
action: function () { |
|
|
|
action: function () { |
|
|
|
self.model.value = self.treeRef.getValue()[0]; |
|
|
|
self.model.value = self.treeRef.getValue()[0]; |
|
|
|
} |
|
|
|
} |
|
|
|